Roles.CookieProtectionValue Eigenschaft

Definition

Ruft einen Wert ab, der angibt, wie in einem Cookie zwischengespeicherte Rollennamen geschützt werden.

public:
 static property System::Web::Security::CookieProtection CookieProtectionValue { System::Web::Security::CookieProtection get(); };
public static System.Web.Security.CookieProtection CookieProtectionValue { get; }
static member CookieProtectionValue : System.Web.Security.CookieProtection
Public Shared ReadOnly Property CookieProtectionValue As CookieProtection

Eigenschaftswert

Einer der CookieProtection-Enumerationswerte, der angibt, wie in einem Cookie zwischengespeicherte Rollennamen geschützt werden. Der Standardwert ist All.

Beispiele

Das folgende Beispiel zeigt das roleManager-Element im system.web Abschnitt der Web.config-Datei für eine ASP.NET-Anwendung. Es gibt an, dass die Anwendung eine SqlRoleProvider -Instanz verwendet und das Attribut auf EncryptedfestlegtcookieProtection.

<roleManager defaultProvider="SqlProvider"
  enabled="true"
  cacheRolesInCookie="true"
  cookieName=".ASPROLES"
  cookieTimeout="30"
  cookiePath="/MyApplication"
  cookieRequireSSL="false"
  cookieSlidingExpiration="true"
  cookieProtection="Encrypted" >
  <providers>
    <add
      name="SqlProvider"
      type="System.Web.Security.SqlRoleProvider"
      connectionStringName="SqlServices"
      applicationName="MyApplication" />
  </providers>
</roleManager>

Hinweise

Sie können den Schutz des Cookies angeben, in dem Rollen für Ihre Anwendung zwischengespeichert werden, indem Sie das cookieProtection Attribut in der Web.config-Datei für Ihre ASP.NET Anwendung festlegen. Das cookieProtection Attribut nimmt einen CookieProtection Enumerationswert an, der angibt, ob die Rollennamen verschlüsselt, überprüft werden, sowohl als auch nicht.

Gilt für:

Weitere Informationen