Assembly: System.Web (in system.web.dll)
/** @event */ public void add_GetRoles (RoleManagerEventHandler value) /** @event */ public void remove_GetRoles (RoleManagerEventHandler value)
In JScript, you can handle the events defined by a class, but you cannot define your own.
The GetRoles event is raised before the RoleManagerModule creates a RolePrincipal object and assigns it to the User property of the CurrentHttpContext. You can use this event to audit when role information is applied or to replace the creation of a RolePrincipal by the RoleManagerModule with your own code.
If you set RolesPopulated to true in your GetRoles event handler, then the User property of the current HttpContext is not set to a RolePrincipal object by the RoleManagerModule.
The following example shows the GetRoles event included in the Global.asax file for an ASP.NET application. The GetRoles event adds a trace notification for an application where trace is enabled in the Web.config file.