lithelike
lithelike

Reputation: 1069

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())

Upvotes: 39

Views: 41120

Answers (2)

alam.net
alam.net

Reputation: 67

try this if you want to check the currently logged in user for specific role:

Roles.IsUserInRole("Admin")

Upvotes: 1

lithelike
lithelike

Reputation: 1069

using System.Web.Security;

Roles.GetRolesForUser() 

Or

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

Upvotes: 67

Related Questions