forms authentication and roles

  • Thread starter Thread starter Phil Townsend
  • Start date Start date
P

Phil Townsend

I am integrating forms authentication in a web app which authenticates
users who are listed in a SQL Server table. There will be a small list
of application roles associated with each user and I would like to store
this list of roles in SQL as well. How would one go about this? Thanks!
 
Phil,

Are you using ASP.NET 2.0? If you are then I would take a look at the
SqlRoleProvider and the SqlMembershipProvider classes. They (along with a
number of other classes) work with the new user/roles framework that is
included in ASP.NET 2.0.

If you are not doing this, then you will have to create a class that
implements IPrincipal, where the implementation would get the roles for the
user from the database and return true or false from IsInRole when called
with a particular role.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top