Asp .Net – Role and Forms Authentication


A while Ago i decided to use both the Forms and role based Authentication for ASP .Net.

I had always created my own login, and used to create a session with the user information. Each time I loade a page that required access, my master pge woud have some code to check if a certain session existed, if not boot the user to the login page.

However Form Based Authentication meant that I would not have to remeber to create that code in every master page, especially when it was already there to use it.
Along with that, I wanted to use a role based authorization. Now with both these, while creting them using the Asp .Net configuration tool, always created its own database, and its own way of handling roles, and I felt i was not in control. Especially if i was to build a site admin to do that.

So I managed to search out articles on using my custom login control to my custom database, but the tricky part was assigning roles. I barely scratched the surface tring to search articles which would explain that.

With spending time trying to find out how it works, I struck upon the RoleProvider Class.
Within no time then i was able to create my custom roles, and now I could use my login table to hold the roles the user has, and make changes accordingly.

If you are struggling with the same I would be glad to help, until I put myself together and write up an article on it.

Advertisements

Leave a Reply / Comment

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s