Click here to Skip to main content
15,127,066 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi sir,
Tell me the steps to set page level permission in asp.net C#. I developed one web application that have 10 aspx page.
If the user has administrator rights , they can able to view all the pages. If the user is a registered user, they can able to view
only 5 aspx file. If the user clicks the menu that is not authorized, i have to show error msg like "You are not authorized to view
this page content".
Posted
Comments
minu1989 1-Apr-13 2:24am
   
<-----------On pageload event use this code------------>

if(Page.User.IsInRole("Administrator"))
{
Response.Redirect("Default.aspx");
}
else
{
Response.Redirect("AccessDenied.aspx");
}
minu1989 1-Apr-13 2:34am
   
Use Membership Providers in your Application.
http://www.tutorialspoint.com/asp.net/asp.net_security.htm
http://www.asp.net/web-forms/tutorials/tailspin-spyworks/tailspin-spyworks-part-6

Hi,
You can use ASP.NET authentication and authorization to provide security in ASP.NET pages.
use following link to understand ..



Beginner's Guide to Authentication and Authorization[^]

Forms Authentication and Role based Authorization: A Quicker, Simpler, and Correct Approach[^]

http://www.4guysfromrolla.com/articles/031204-1.aspx[^]
   
Best option is asp.net membership.

you will successfully resolve the issues regarding tablelocks or transaction dead locks.

1.Setup ASP.NET Membership provider database using Microsoft SQL server 2005
2.Create user
3.Create Role Add user in Role
4.Provider Role based security to your application
5.Redirecting authorized users to see his web section to which he is authorized to see
6.Password recovery control and configuration.
7.Single Sign in / single login / single signin

Follow below link for more details:

ASP.NET Membership
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900