System.Web.Security.RoleManagerModule.GetRoles Event

A global application event that is raised when the System.Web.Security.RoleManagerModule is ready to create a System.Web.Security.RolePrincipal that represents the current user.


public event RoleManagerEventHandler GetRoles


The RoleManagerModule.GetRoles event is raised before the System.Web.Security.RoleManagerModule creates a System.Web.Security.RolePrincipal object and assigns it to the System.Web.HttpContext.User property of the System.Web.HttpContext.Current System.Web.HttpContext. You can use this event to audit when role information is applied or to replace the creation of a System.Web.Security.RolePrincipal by the System.Web.Security.RoleManagerModule with your own code.

You can cancel the application of role information by the System.Web.Security.RoleManagerModule by setting the RoleManagerEventArgs.RolesPopulated property of the System.Web.Security.RoleManagerEventArgs to true in the RoleManagerModule.GetRoles event.

If you set RoleManagerEventArgs.RolesPopulated to true in your RoleManagerModule.GetRoles event handler, then the System.Web.HttpContext.User property of the current System.Web.HttpContext is not set to a System.Web.Security.RolePrincipal object by the System.Web.Security.RoleManagerModule.


Namespace: System.Web.Security
Assembly: System.Web (in System.Web.dll)
Assembly Versions:
Since: .NET 2.0