RolePrincipal.IsInRole Method
Assembly: System.Web (in system.web.dll)
| Exception type | Condition |
|---|---|
|
The Identity property is a null reference (Nothing in Visual Basic). |
IsInRole first checks IsRoleListCached to see if there is a cached list of role names for the current user. If the IsRoleListCached property is true, then the cached list is checked for the specified role. When role names are cached in a cookie, both allowed role names and denied role names are cached for the user. If the IsInRole method finds the specified role in the cached list of allowed role names, then it will return true. If the IsInRole method finds the specified role in the cached list of denied role names, then it will return false. If IsInRole does not find the specified role in either the allowed or denied list of role names, then it will call the IsUserInRole method of the default role Provider to determine whether a user name is associated with a role from the data source for the configured ApplicationName.