Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi every body,

In my website, any one can access specific pages by write url in Browser Address,

How to prevent that where these pages are not allowed for any one but for Authenticated users only?

Thanks
Posted

Have a look at below link for information on "Asp.Net Forms Authentication".

http://msdn.microsoft.com/en-us/library/ff647070.aspx
 
Share this answer
 
If you want to have your own security model other than the one provided by Microsoft, then make a user control and check the
HTML
Session["LoggedIn"]
variable , in
HTML
OnLoad 
event handler ,to see if the user is logged in or not; if he had not logged in then redirect him to login page.

In login page if the user logged in successfully set the
HTML
Session["LoggedIn"]
to true.

Place this user control in every page you want to have restriction in it, or you can place it in master page to apply restriction to all pages without the need to place it in each individual page.
 
Share this answer
 
Look like a lot of reading here ^_^. that is my problem before and got a solution here.

http://www.4guysfromrolla.com/webtech/110701-1.shtml[^]
http://www.4guysfromrolla.com/webtech/LearnMore/Authentication.asp[^]
Basically Just follw the steps and you colud learn a lot


Happy Programming!!
 
Share this answer
 
put those pages inside a folder.And add a web.config file in this folder.Inside the web.config put deny users=? so in this way when people try to access those pages they will be redirected to the login page automatically.
 
Share this answer
 

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