Compartir vía


FormsAuthenticationConfiguration.Protection Propiedad

Definición

Obtiene o establece el tipo de cifrado utilizado para cifrar la cookie.

public:
 property System::Web::Configuration::FormsProtectionEnum Protection { System::Web::Configuration::FormsProtectionEnum get(); void set(System::Web::Configuration::FormsProtectionEnum value); };
[System.Configuration.ConfigurationProperty("protection", DefaultValue=System.Web.Configuration.FormsProtectionEnum.All)]
public System.Web.Configuration.FormsProtectionEnum Protection { get; set; }
[<System.Configuration.ConfigurationProperty("protection", DefaultValue=System.Web.Configuration.FormsProtectionEnum.All)>]
member this.Protection : System.Web.Configuration.FormsProtectionEnum with get, set
Public Property Protection As FormsProtectionEnum

Valor de propiedad

Uno de los FormsProtectionEnum valores de enumeración. El valor predeterminado es All.

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

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

Atributos

Ejemplos

En el ejemplo de código siguiente se muestra cómo acceder a la Protection propiedad . Consulte el ejemplo de código del tema de clase FormsAuthenticationConfiguration para obtener información sobre cómo obtener la sección.

// Get the current Protection.
FormsProtectionEnum currentProtection =
    formsAuthentication.Protection;

// Set the Protection property.
formsAuthentication.Protection =
    FormsProtectionEnum.All;
' Get the current Protection.
Dim currentProtection As FormsProtectionEnum =
formsAuthentication.Protection

' Set the Protection property.
formsAuthentication.Protection = FormsProtectionEnum.All

Se aplica a

Consulte también