WindowsTokenRoleProvider 类   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
通过 Windows 组成员资格获取 ASP.NET 应用程序的角色信息。
public ref class WindowsTokenRoleProvider : System::Web::Security::RoleProviderpublic class WindowsTokenRoleProvider : System.Web.Security.RoleProvidertype WindowsTokenRoleProvider = class
    inherit RoleProviderPublic Class WindowsTokenRoleProvider
Inherits RoleProvider- 继承
示例
以下示例演示 ASP.NET 应用程序的 Web.config 文件。 它指定应用程序使用 Windows 身份验证和 WindowsTokenRoleProvider 类来检索 Windows 用户的角色信息。 
              authorization元素指定仅允许 BUILTIN\Administrators 组中的用户访问应用程序。
<configuration>
  <system.web>
    <authentication mode="Windows" />
    <authorization>
      <allow roles="BUILTIN\Administrators" />
      <deny users="*" />
    </authorization>
    <roleManager defaultProvider="WindowsProvider"
      enabled="true"
      cacheRolesInCookie="false">
      <providers>
        <add
          name="WindowsProvider"
          type="System.Web.Security.WindowsTokenRoleProvider" />
      </providers>
    </roleManager>
  </system.web>
</configuration>
注解
类 WindowsTokenRoleProvider 是只读角色成员身份提供程序,它基于 Windows 安全组检索 Windows 用户的角色信息。 对于使用 Windows 身份验证模式(其中 IIS 身份验证设置禁用匿名身份验证)的 ASP.NET 应用程序,它最有用。 可以将 ASP.NET 应用程序配置为基于用户在特定 Windows 组中的成员身份允许或拒绝访问。
不能使用 WindowsTokenRoleProvider 类创建或删除角色或修改基于 Windows 组成员身份的角色的成员身份。 此功能由 Windows 操作系统管理。 类WindowsTokenRoleProvider仅IsUserInRole支持抽象类的 RoleProvider 和 GetRolesForUser 方法。
构造函数
| WindowsTokenRoleProvider() | 创建 WindowsTokenRoleProvider 类的实例。 | 
属性
| ApplicationName | 获取或设置应用程序的名称。 | 
| Description | 获取一条简短的易懂描述,它适合在管理工具或其他用户界面 (UI) 中显示。(继承自 ProviderBase) | 
| Name | 获得一个友好名称,用于在配置过程中引用提供程序。(继承自 ProviderBase) | 
方法
| AddUsersToRoles(String[], String[]) | Windows 标记角色提供程序不支持此方法。 | 
| CreateRole(String) | Windows 标记角色提供程序不支持此方法。 | 
| DeleteRole(String, Boolean) | Windows 标记角色提供程序不支持此方法。 | 
| Equals(Object) | 确定指定对象是否等于当前对象。(继承自 Object) | 
| FindUsersInRole(String, String) | Windows 标记角色提供程序不支持此方法。 | 
| GetAllRoles() | Windows 标记角色提供程序不支持此方法。 | 
| GetHashCode() | 作为默认哈希函数。(继承自 Object) | 
| GetRolesForUser(String) | 获取用户所属的 Windows 组的列表。 | 
| GetType() | 获取当前实例的 Type。(继承自 Object) | 
| GetUsersInRole(String) | Windows 标记角色提供程序不支持此方法。 | 
| Initialize(String, NameValueCollection) | 利用在 ASP.NET 应用程序的配置文件中指定的属性值初始化 Windows 标记角色提供程序。 此方法不能直接在代码中使用。 | 
| IsUserInRole(String, String) | 获取一个值,它指示指定的用户是否属于指定的 Windows 组。 | 
| IsUserInRole(String, WindowsBuiltInRole) | 获取一个值,它指示指定的用户是否扮演指定的内置 Windows 角色。 | 
| MemberwiseClone() | 创建当前 Object 的浅表副本。(继承自 Object) | 
| RemoveUsersFromRoles(String[], String[]) | Windows 标记角色提供程序不支持此方法。 | 
| RoleExists(String) | Windows 标记角色提供程序不支持此方法。 | 
| ToString() | 返回表示当前对象的字符串。(继承自 Object) |