System.Web.Security.RolePrincipal.GetRoles Method

Gets a list of roles that the System.Web.Security.RolePrincipal is a member of.

Syntax

public string[] GetRoles ()

Returns

The list of roles that the System.Web.Security.RolePrincipal is a member of.

Remarks

If Roles.CacheRolesInCookie is true and role names have been cached for the user represented by the System.Web.Security.RolePrincipal, then the RolePrincipal.GetRoles method will return the list of role names in the cache that the user is a member of. If role names have not been cached, then the RolePrincipal.GetRoles method returns the list of role names that the user is a member of from the default role Roles.Provider. Only role names for the current Roles.ApplicationName are returned. To determine whether role names have been cached in the System.Web.Security.RolePrincipal object, check the RolePrincipal.IsRoleListCached property.

Requirements

Namespace: System.Web.Security
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0