Condividi tramite


AnonymousIdentificationSection.CookieProtection Proprietà

Definizione

Ottiene o imposta il tipo di crittografia utilizzato per crittografare 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à

Uno dei CookieProtection valori. Il valore predefinito è All.

Attributi

Esempio

Nell'esempio di codice seguente viene illustrato come accedere alla CookieProtection proprietà .

// 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, è consigliabile impostare anche la CookieRequireSSL proprietà su true.

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

Si applica a