Share via


AnonymousIdentificationSection.CookieProtection Propiedad

Definición

Obtiene o establece el tipo de cifrado que se utiliza para cifrar la 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

Valor de propiedad

CookieProtection

Uno de los valores de CookieProtection. El valor predeterminado es All.

Atributos

Ejemplos

El siguiente ejemplo de código muestra cómo obtener acceso a la propiedad 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)

Comentarios

Para mejorar la protección de la cookie, es posible que también desee establecer la CookieRequireSSL propiedad en true.

Asegúrese de usar el valor predeterminado para esta propiedad si desea que tanto la validación de datos como el cifrado ayuden a proteger la cookie. Esta opción usa el algoritmo de validación de datos configurado. Triple-DES (3DES) se usa para el cifrado, si está disponible y si la clave es suficientemente larga (48 bytes o más).

Se aplica a