I just want to know that how to make a role base web-application?
There are different-diffrent users in my sytem, like Admin, Approver, user etc.
So, how is it possible?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Soft CornerPosted Feb 23, 2011, 12:54 AM
For role based forms authentication you need to create a database for the users which will store the user's password and their roles in the website. For example you might create a table named "members" with the userid, password, and roles as the fields in that table. While creating the roles you have to think over the types of roles that are required for your website and create accordingly. Once you create a table in a database the steps involved in achieving role based forms authentication would be:
1. Create the login page
2. In the click event of the login button write code for the following algorithm
3. Modify the Application_AuthenticateRequest event handler in the Global.asax file to get the stored role value and generate a new principal.
4. Add the principal to the current context for the user so that you can retrieve the roles.
5. Modify the web.config file to control authorization.
The above steps are performed to complete the role based authentication in ASP.Net. You should have organized your website content in folders based on user roles which makes it easy for you to grant permissions for the users to access those contents. A web.config file must be present in the root of the web applications directory for the role based forms authentication to function properly. It is possible to override the authorization in the web.config files in the sub-directories.
A sample code for the web.config file in the root directory of the web application would look something like given below:
protection="All"
path="/"/>
This web.config file can be split so that you can delete some block in the above code and have a separate web.config file for the sub-directories. In that case it is enough if you have only the , , , , and elements in the web.config file in the sub-directory.
Soft CornerPosted Feb 23, 2011, 2:01 AM
take this rar file ..
Sahil JaniPosted Feb 23, 2011, 1:52 AM
Soft CornerPosted Feb 23, 2011, 1:49 AM
I have attached sample code in txt file .. look for that ...
Let me know if you still have any problem :)
Sahil JaniPosted Feb 23, 2011, 1:19 AM
Please let me know.