AnonymousIdentificationSection.CookieProtection Egenskap

Definition

Hämtar eller anger den krypteringstyp som används för att kryptera cookien.

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.Validation)]
public System.Web.Security.CookieProtection CookieProtection { get; set; }
[<System.Configuration.ConfigurationProperty("cookieProtection", DefaultValue=System.Web.Security.CookieProtection.Validation)>]
member this.CookieProtection : System.Web.Security.CookieProtection with get, set
Public Property CookieProtection As CookieProtection

Egenskapsvärde

Ett av CookieProtection värdena. Standardvärdet är All.

Attribut

Exempel

Följande kodexempel visar hur du kommer åt egenskapen CookieProtection .

// Get CookieProtection.
System.Web.Security.CookieProtection cookieProtection =
    anonymousIdentificationSection.CookieProtection;
Console.WriteLine("Cookie protection: {0}",
           cookieProtection);
' Get CookieProtection.
Dim cookieProtection _
As System.Web.Security.CookieProtection = _
anonymousIdentificationSection.CookieProtection
Console.WriteLine( _
"Cookie protection: {0}", cookieProtection)

Kommentarer

För att förbättra skyddet av din cookie kanske du också vill ange egenskapen CookieRequireSSL till true.

Se till att använda standardvärdet för den här egenskapen om du vill att både dataverifiering och kryptering ska hjälpa till att skydda cookien. Det här alternativet använder den konfigurerade algoritmen för dataverifiering. Triple-DES (3DES) används för kryptering, om det är tillgängligt och om nyckeln är tillräckligt lång (48 byte eller mer).

Gäller för