what is the code for determining if a user is in a role. I have setup all the users through the ASP.Net configuration Security tab but now want to put logic around some key areas so only people in certain roles can see and access these areas.
views:
599answers:
3what namespace is user in?
ooo
2009-07-31 18:01:25
User is a property of the Page and HttpContext classes, so you can access it on the page simply as User, or in non-page file as HttpContext.Current.User. More info at MSDN: http://msdn.microsoft.com/en-us/library/system.web.httpcontext.user.aspx
Chris Pebble
2009-07-31 18:08:30
A:
Check out the Roles class, specifically IsUserInRole, GetUsersInRole, AddUserToRole, etc.
I use these all the time.
Matthew Jones
2009-07-31 17:58:05
this code will looks into the sql database (thats my provider) to determine role in asp.net?
ooo
2009-07-31 17:59:50