Friday, August 28, 2009

Getting user role ID's

Ok, so I ran into this issue when I was working on a website using ASP.net's Membership class. I wanted to get the user role ID's instead of just their string names. That way if a string name changed I wouldn't have to go and update other tables.

Anyway, I couldn't find anything on a method that does that for you but I did find an article on this site http://www.andreas-kraus.net/blog/aspnet-membership-get-the-userid-of-the-user/ , which tells you how to get the user ID. From there you can just query the aspnet_UsersInRole table in your membership db and it will return all the role id's for that user.

No comments:

Post a Comment