Compartilhar via


AnonymousIdentificationSection.CookieProtection Propriedade

Definição

Obtém ou define o tipo de criptografia usado para criptografar 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 da propriedade

Um dos CookieProtection valores. O valor padrão é All.

Atributos

Exemplos

O exemplo de código a seguir mostra como acessar a 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)

Comentários

Para melhorar a proteção do cookie, convém também definir a CookieRequireSSL propriedade como true.

Use o valor padrão dessa propriedade se desejar validação de dados e criptografia para ajudar a proteger o cookie. Essa opção usa o algoritmo de validação de dados configurado. Triple-DES (3DES) é usado para criptografia, se disponível e se a chave for longa o suficiente (48 bytes ou mais).

Aplica-se a