RolePrincipal.IsInRole Method
.NET Framework 3.0
Gets a value indicating whether the user represented by the RolePrincipal is in the specified role.
Namespace: System.Web.Security
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
| Exception type | Condition |
|---|---|
|
The Identity property is a null reference (Nothing in Visual Basic). |
IsInRole first checks the IsRoleListCached property to determine whether a cached list of role names for the current user is available. If the IsRoleListCached property is true, the cached list is checked for the specified role. If the IsInRole method finds the specified role in the cached list, it returns true.
If IsInRole does not find the specified role, it calls the GetRolesForUser method of the default Provider instance to determine whether the user name is associated with a role from the data source for the configured ApplicationName value.
Community Additions
ADD
Show: