FormsAuthenticationConfiguration.Protection Eigenschaft
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Ruft den Verschlüsselungstyp ab, der zum Verschlüsseln des Cookies verwendet wird, oder legt diesen fest.
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
Eigenschaftswert
Einer der FormsProtectionEnum Enumerationswerte. Der Standardwert ist All.
Hinweis Achten Sie darauf, den Standardwert für diese Eigenschaft zu verwenden, wenn Sie sowohl die Datenüberprüfung als auch die Verschlüsselung zum Schutz des Cookies verwenden möchten. Diese Option verwendet den konfigurierten Datenüberprüfungsalgorithmus basierend auf dem machineKey. Triple-DES (3DES) wird für die Verschlüsselung verwendet, sofern verfügbar und der Schlüssel lang genug ist (48 Bytes oder mehr).
Um den Schutz Ihres Cookies zu verbessern, möchten Sie möglicherweise auch den RequireSSL Aufsatz festlegen true.
- Attribute
Beispiele
Das folgende Codebeispiel zeigt, wie Sie auf die Protection Eigenschaft zugreifen. Weitere Informationen zum Abrufen des Abschnitts finden Sie im Codebeispiel im FormsAuthenticationConfiguration Klassenthema.
// 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