FormsAuthenticationConfiguration.Protection Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee haalt u het versleutelingstype op dat wordt gebruikt voor het versleutelen van de 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
Waarde van eigenschap
Een van de FormsProtectionEnum opsommingswaarden. De standaardwaarde is All.
Opmerking Zorg ervoor dat u de standaardwaarde voor deze eigenschap gebruikt als u zowel gegevensvalidatie als versleuteling wilt gebruiken om de cookie te beschermen. Deze optie maakt gebruik van het geconfigureerde algoritme voor gegevensvalidatie op basis van de machineKey. Triple-DES (3DES) wordt gebruikt voor versleuteling, indien beschikbaar en of de sleutel lang genoeg is (48 bytes of meer).
Om de bescherming van uw cookie te verbeteren, kunt u het volgende instellen RequireSSLtrue.
- Kenmerken
Voorbeelden
In het volgende codevoorbeeld ziet u hoe u toegang hebt tot de Protection eigenschap. Raadpleeg het codevoorbeeld in het FormsAuthenticationConfiguration klasonderwerp voor meer informatie over het ophalen van de sectie.
// 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