Roles.Enabled 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定一個值,指示目前網頁應用程式是否啟用角色管理。
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
屬性值
true若啟用角色管理;否則,。 false 預設值為 false。
範例
以下範例展示了 ASP.NET 應用程式 Web.config 檔案區塊中的 system.web 元素。 它指定應用程式使用實 SqlRoleProvider 例,並將屬性設定 enabled 為 true。
<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>