Role Management Classes

Role management consists of a set of classes and interfaces that establish roles for the current user and that manage role information. The following table shows the role management classes and functions that they provide.




Provides general management facilities for roles.

Creates roles.

Adds users to roles.

Determines whether specific user is in role.

Gets roles for users.

Removes users from role.

Manages the cookie containing role information.


The functions for creating roles and assigning users to them do not work if you are using the WindowsTokenRoleProvider. In that case, you manage role information using Windows.


Defines functionality for data providers that can be used by role-management services.

Defines the functionality a provider must implement to be used by the Roles class.


Adds role information to the current User property.

Automatically creates a RolePrincipal and attaches it to the current context.

Raises a GetRoles event that allows you to customize the process of adding roles to the current user context.


Defines arguments passed to the RoleManager_GetRoles event.

Provides access to the current user context during the GetRoles event.


Acts as a IPrincipal object and caches the roles for a user.

Stores role information for the current user.

Manages retrieval of role information from either the cookie or the database (or both, if necessary).


Provides access to roles as a Windows Communication Framework service.

Checks whether a user belongs to a specified role.

Retrieves all roles for a user.


General role-management features are not available through the RoleService class.

See Also


Understanding Role Management

Role Management Providers

Windows Communication Foundation Role Service Overview

Other Resources

Securing ASP.NET Web Sites