The query posted can be seen here http://stackoverflow.com/questions/1672007/user-roles-why-not-store-in-session

My obvious question is that why do you want to store a users role in session ?

Here is my answer to your query, how this helps. I have attached a small demo application for you to take a look at and understand my points. When you open this project in visual studio, click on the project tab on the top and select asp.net configuration. From the page that will show up you can do the user administration stuff.

You need to store the roles of a user in some secure manner ? The answer to this question is that there is no need for you to worry about storing the role for any user, when we have the asp.net membership, profiles and roles framework to help us out on this. All you need to do is create a role in the aspnet database and assign that role to the user.

Next you want to store two string in some secure manner. I suggest you user profile for storing user specific information. This way you have the information available to you where ever you want from the profilecommon class.

Also please see the attached demo application. Hope this helps.

DemoApplication.rar (3.78 mb)