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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Soft CornerRank #1,221 · 1.5K reputationPosted Feb 22, 2011, 7:54 PM EST
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.
Sahil Jani196 reputationPosted Feb 22, 2011, 8:19 PM EST
Please let me know.
Soft CornerRank #1,221 · 1.5K reputationPosted Feb 22, 2011, 8:49 PM EST
I have attached sample code in txt file .. look for that ...
Let me know if you still have any problem :)
Sahil Jani196 reputationPosted Feb 22, 2011, 8:52 PM EST
Soft CornerRank #1,221 · 1.5K reputationPosted Feb 22, 2011, 9:01 PM EST
take this rar file ..