Roles.Enabled Eigenschaft

Definition

Ruft einen Wert ab, der angibt, ob Rollenverwaltung für die aktuelle Webanwendung aktiviert ist, oder legt diesen fest.

public:
 static property bool Enabled { bool get(); };
public:
 static property bool Enabled { bool get(); void set(bool value); };
public static bool Enabled { get; }
public static bool Enabled { get; set; }
static member Enabled : bool
static member Enabled : bool with get, set
Public Shared ReadOnly Property Enabled As Boolean
Public Shared Property Enabled As Boolean

Eigenschaftswert

true, wenn Rollenverwaltung aktiviert ist, andernfalls false. Der Standardwert ist false.

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 enabled -Attribut auf truefestlegt.

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

Gilt für:

Weitere Informationen