Asp.net Page access Control

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2008
Posts: 8
Reputation: sanbal is an unknown quantity at this point 
Solved Threads: 0
sanbal sanbal is offline Offline
Newbie Poster

Asp.net Page access Control

 
0
  #1
Oct 21st, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 8
Reputation: n4naeem is an unknown quantity at this point 
Solved Threads: 1
n4naeem n4naeem is offline Offline
Newbie Poster

Re: Asp.net Page access Control

 
0
  #2
Oct 21st, 2008
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
}
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 8
Reputation: sanbal is an unknown quantity at this point 
Solved Threads: 0
sanbal sanbal is offline Offline
Newbie Poster

Re: Asp.net Page access Control

 
0
  #3
Oct 21st, 2008
Thanks for your reply. Let me try with this and get back to you.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC