System.Web.Security.RolePrincipal.IsInRole C# (CSharp) Method

IsInRole() public method

public IsInRole ( string role ) : bool
role string
return bool
		public bool IsInRole (string role)
		{
			if (!_identity.IsAuthenticated)
				return false;

			GetRoles ();

			return _cachedRoles [role] != null;
		}
		

Usage Example

Example #1
0
        static public bool DeleteRole(string roleName, bool throwOnPopulatedRole)
        {
            EnsureEnabled();
            SecUtility.CheckParameter(ref roleName, true, true, true, 0, "roleName");

            bool roleDeleted = Provider.DeleteRole(roleName, throwOnPopulatedRole);

            try {
                RolePrincipal user = GetCurrentUser() as RolePrincipal;
                if (user != null && user.ProviderName == Provider.Name && user.IsRoleListCached && user.IsInRole(roleName))
                {
                    user.SetDirty();
                }
            }
            catch { }

            return(roleDeleted);
        }