Condividi tramite


AnonymousIdentificationSection.CookieProtection Proprietà

Definizione

Ottiene o imposta il tipo di crittografia utilizzato per il cookie.

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

Valore della proprietà

CookieProtection

Uno dei valori di CookieProtection. Il valore predefinito è All.

Attributi

Esempio

Nell'esempio di codice seguente viene illustrato come accedere alla proprietà 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)

Commenti

Per migliorare la protezione del cookie, è possibile impostare anche la CookieRequireSSL proprietà su true.

Assicurarsi di usare il valore predefinito per questa proprietà se si desidera che sia la convalida dei dati che la crittografia consentano di proteggere il cookie. Questa opzione usa l'algoritmo di convalida dei dati configurato. Per la crittografia viene usato Triple DES (3DES), se è disponibile e se la chiave è sufficientemente lunga (almeno 48 byte).

Si applica a