Click here to Skip to main content
15,664,273 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?


Have a look at below link for information on "Asp.Net Forms Authentication".
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
variable , in
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
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.[^][^]
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