WindowsTokenRoleProvider Class
Gets role information for an ASP.NET application from Windows group membership.
Assembly: System.Web (in System.Web.dll)
System.Configuration.Provider.ProviderBase
System.Web.Security.RoleProvider
System.Web.Security.WindowsTokenRoleProvider
| Name | Description | |
|---|---|---|
![]() | WindowsTokenRoleProvider() | Creates an instance of the WindowsTokenRoleProvider class. |
| Name | Description | |
|---|---|---|
![]() | ApplicationName | Gets or sets the name of the application.(Overrides RoleProvider.ApplicationName.) |
![]() | Description | Gets a brief, friendly description suitable for display in administrative tools or other user interfaces (UIs).(Inherited from ProviderBase.) |
![]() | Name | Gets the friendly name used to refer to the provider during configuration.(Inherited from ProviderBase.) |
| Name | Description | |
|---|---|---|
![]() | AddUsersToRoles(String[], String[]) | This method is not supported by the Windows token role provider.(Overrides RoleProvider.AddUsersToRoles(String[], String[]).) |
![]() | CreateRole(String) | This method is not supported by the Windows token role provider.(Overrides RoleProvider.CreateRole(String).) |
![]() | DeleteRole(String, Boolean) | This method is not supported by the Windows token role provider.(Overrides RoleProvider.DeleteRole(String, Boolean).) |
![]() | Equals(Object) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | Finalize() | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.) |
![]() | FindUsersInRole(String, String) | This method is not supported by the Windows token role provider.(Overrides RoleProvider.FindUsersInRole(String, String).) |
![]() | GetAllRoles() | This method is not supported by the Windows token role provider.(Overrides RoleProvider.GetAllRoles().) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetRolesForUser(String) | Gets a list of the Windows groups that a user is in.(Overrides RoleProvider.GetRolesForUser(String).) |
![]() | GetType() | |
![]() | GetUsersInRole(String) | This method is not supported by the Windows token role provider.(Overrides RoleProvider.GetUsersInRole(String).) |
![]() | Initialize(String, NameValueCollection) | Initializes the Windows token role provider with the property values specified in the configuration file for the ASP.NET application. This method is not intended to be used directly from your code.(Overrides ProviderBase.Initialize(String, NameValueCollection).) |
![]() | IsUserInRole(String, String) | Gets a value indicating whether the specified user is in the specified Windows group.(Overrides RoleProvider.IsUserInRole(String, String).) |
![]() | IsUserInRole(String, WindowsBuiltInRole) | Gets a value indicating whether the specified user is in the specified built-in Windows role. |
![]() | MemberwiseClone() | |
![]() | RemoveUsersFromRoles(String[], String[]) | This method is not supported by the Windows token role provider.(Overrides RoleProvider.RemoveUsersFromRoles(String[], String[]).) |
![]() | RoleExists(String) | This method is not supported by the Windows token role provider.(Overrides RoleProvider.RoleExists(String).) |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
The WindowsTokenRoleProvider class is a read-only role-membership provider that retrieves role information for a Windows user based on Windows security groups. It is most useful with ASP.NET applications that use Windows authentication mode where the IIS authentication settings disable anonymous authentication. You can configure ASP.NET applications to allow or deny access based on a user's membership in a particular Windows group.
You cannot use the WindowsTokenRoleProvider class to create or delete roles or modify the membership of a role that is based on Windows group membership. This functionality is managed by the Windows operating system. The WindowsTokenRoleProvider class supports only the IsUserInRole and GetRolesForUser methods of the RoleProvider abstract class.
The following example shows the Web.config file for an ASP.NET application. It specifies that the application uses both Windows authentication and the WindowsTokenRoleProvider class to retrieve role information for Windows users. The element specifies that only users in the BUILTIN\Administrators group are allowed access to the application.
<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>
Available since 2.0
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


