Search code examples
asp.netasp.net-membership

How do I get a list of roles for the currently logged in user


I want to know what roles a logged in user belongs to without having to check the user against all possible roles (i.e. using Page.User.IsInRole())


Solution

  • using System.Web.Security;

    Roles.GetRolesForUser() 
    

    Or

    Roles.GetRolesForUser(String) if not targeting the currently logged in user.