Roles.Enabled 属性 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置用来指示是否为当前 Web 应用程序启用角色管理的值。
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 : boolstatic member Enabled : bool with get, setPublic Shared ReadOnly Property Enabled As BooleanPublic Shared Property Enabled As Boolean属性值
如果启用了角色管理,则为 true;否则为 false。 默认值为 false。
示例
以下示例演示 ASP.NET 应用程序的 Web.config 文件的 节中的 system.webroleManager 元素。 它指定应用程序使用 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>