Gets a value indicating whether the user represented by the System.Web.Security.RolePrincipal is in the specified role.
true if user represented by the System.Web.Security.RolePrincipal is in the specified role; otherwise, false.
RolePrincipal.IsInRole(string) first checks the RolePrincipal.IsRoleListCached property to determine whether a cached list of role names for the current user is available. If the RolePrincipal.IsRoleListCached property is true, the cached list is checked for the specified role. If the RolePrincipal.IsInRole(string) method finds the specified role in the cached list, it returns true.
If RolePrincipal.IsInRole(string) does not find the specified role, it calls the RoleProvider.GetRolesForUser(string) method of the default Roles.Provider instance to determine whether the user name is associated with a role from the data source for the configured Roles.ApplicationName value.