RoleManagerSection.CookieProtection Egenskap

Definition

Hämtar eller anger den typ av säkerhet som används för att skydda cookien som cachelagrar rollnamn.

public:
 property System::Web::Security::CookieProtection CookieProtection { System::Web::Security::CookieProtection get(); void set(System::Web::Security::CookieProtection value); };
[System.Configuration.ConfigurationProperty("cookieProtection", DefaultValue=System.Web.Security.CookieProtection.All)]
public System.Web.Security.CookieProtection CookieProtection { get; set; }
[<System.Configuration.ConfigurationProperty("cookieProtection", DefaultValue=System.Web.Security.CookieProtection.All)>]
member this.CookieProtection : System.Web.Security.CookieProtection with get, set
Public Property CookieProtection As CookieProtection

Egenskapsvärde

Den typ av säkerhetsskydd som används i cookien där rollnamn cachelagras. Standardvärdet är All.

Attribut

Exempel

Följande kodexempel visar hur du använder egenskapen CookieProtection . Det här kodexemplet är en del av ett större exempel för RoleManagerSection klassen.

// Display CookieProtection property.
Console.WriteLine("CookieProtection: {0}",
  configSection.CookieProtection);
' Display CookieProtection property.
Console.WriteLine("CookieProtection: {0}", _
 configSection.CookieProtection)

Kommentarer

Egenskapen CookieProtection beskriver hur information i en cookie lagras på ett säkert sätt. Du kan ange säkerhetstypen för cookien där roller cachelagras för ditt program genom att ange attributet cookieProtection i Web.config-filen för ditt ASP.NET-program. Attributet cookieProtection tar uppräkningsvärdet CookieProtectionAll, Encryption, None, eller Validation. Standardvärdet är All. Se till att använda standardvärdet för CookieProtection egenskapen om du vill att både dataverifiering och kryptering ska skydda cookien. För att förbättra skyddet av din cookie kan du också ange egenskapen CookieRequireSSL till true.

Gäller för

Se även