944,007 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 1931
  • ASP.NET RSS
Oct 21st, 2008
0

Asp.net Page access Control

Expand Post »
HI,

I am new to Asp.net . i have a login page, with user role like guest, member, admin.I want to control the page access based on their role. How can we do this in asp.net and c#.

Thanks.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sanbal is offline Offline
12 posts
since Aug 2008
Oct 21st, 2008
0

Re: Asp.net Page access Control

you can make access to different pages by using Session.

every user has its own role. so in database define Roles for every user.

like
there would be three fields ..

User name , Password and Role.

when you click on the button sign in
if the username and password matched.

put the respective role in the session variable like that.

like .... Session["Role"] = "Admin";

now check in every page_load event of every page.

like

Page_Load()
{

if(Session["Role"].ToString() != "Admin")
{
Response.Redirect("Login.aspx");
}
// same thing u can use for every user role
}
Reputation Points: 10
Solved Threads: 1
Newbie Poster
n4naeem is offline Offline
8 posts
since Oct 2008
Oct 21st, 2008
0

Re: Asp.net Page access Control

Thanks for your reply. Let me try with this and get back to you.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sanbal is offline Offline
12 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Defalut page for website not getting accessed
Next Thread in ASP.NET Forum Timeline: error in database connection





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC