how to set page level permission in asp.net c#?

Posted by Prabu_Spark under ASP.NET on 4/1/2013 | Points: 10 | Views : 6679 | Status : [Member] | Replies : 4
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".

With regards,
J.Prabu.
[Email:prbspark@gmail.com]



Responses

Posted by: .Netlearner on: 4/1/2013 [Member] Starter | Points: 25

Up
0
Down
Hello Prabhu,
you can use session variables to set the authorization. Once Login process is completed store the Usertype of the particular user in a session variable. Then in page load of main menu page check the session value. Whether its administrator/User. Then if User while clicking on a particular menu that u want to hide just redirect to some other page specifying that Usera are not authorized to view the content of this page.

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: .Netlearner on: 4/1/2013 [Member] Starter | Points: 25

Up
0
Down
Session["UserType"]=UserType.ToString();


If(Session["UserType"].toString()=="User")
{
response.redirect("needauthorization.aspx");
}


Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santhiram on: 4/1/2013 [Member] Starter | Points: 25

Up
0
Down
Check this link.
http://www.codeproject.com/Articles/301324/Authorization-in-ASP-NET

Very well clearly explained all the situations we need to do while authorizing a website.


Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Giangnamnam on: 5/21/2013 [Member] Starter | Points: 25

Up
0
Down
http://www.youtube.com/watch?v=EX9LwIEWCbQ&feature=youtu.be
Please view my video,I hope help you

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response