AnonymousIdentificationSection.CookieProtection Propriedade

Definição

Obtém ou define o tipo de encriptação usado para encriptar o 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 Propriedade

Um dos CookieProtection valores. O valor predefinido é All.

Atributos

Exemplos

O seguinte exemplo de código mostra como aceder à CookieProtection propriedade.

// 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)

Observações

Para melhorar a proteção do seu cookie, pode também querer definir a CookieRequireSSL propriedade para true.

Certifique-se de usar o valor padrão desta propriedade se quiser validação de dados e encriptação para ajudar a proteger o cookie. Esta opção utiliza o algoritmo de validação de dados configurado. Triple-DES (3DES) é usado para encriptação, se disponível e se a chave for suficientemente longa (48 bytes ou mais).

Aplica-se a