Click here to Skip to main content
15,906,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have 4 pages web application
first page is logg in page.. where the user logg in
and then redirected to 1.aspx,

but when user click the back button on browser, application redirectd to logg in page
and after this , when user click the forward button on browser it redirects again to 1.aspx without
asking ID , password.

and also if user knows the link of the page i:e 1.aspx
he can also access this page without giving ID, password
by jst typing the URL of page in browser..

how can i prevent my app, from this??

like when user logged inn and clik back his session get expire
and he has to give ID and password again to access 1.aspx

and nobody can access the page by simply giving the URL of page

need help! (i am beginner)

You can disable back button check this link How to disable browser's back button[^]
Share this answer
syed armaan hussain 3-May-12 17:19pm    
thnks ur sharing is really worthy !
but it is not what i want .
syed armaan hussain 4-May-12 14:25pm    
i placed this code at my page_load event, but it is not working

Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
Response.Expires = -1500;
Response.CacheControl = "no-cache";
The simplest way is to have a method on the load event of each page which checks to see what the status of the user is. Once they've logged in, you could set a variable to indicate that the user is valid. Store this in the Session and then check it as and when. If the user doesn't pass the test then redirect back to the login page. Plainly, that is a very simplistic overview but should set you in the right direction. There are a lot of ways to do this so you just need to find the method that is appropriate to your requirements. Try searching here and Google for articles that will explain this in more depth - I believe there a couple of really good articles here on web security if you take some time to look.
Share this answer
syed armaan hussain 2-May-12 19:02pm    
thanks alot sir .. if u have a link of any good article regarding to my problem plx share it with me .. i am searching for the solution of this problem for an hour on internet but didnt find an exact solution

R. Giskard Reventlov 2-May-12 19:13pm    
You probably won't find an exact solution: what you have to do is read and understand what you find and then adapt it to your needs.
syed armaan hussain 3-May-12 17:14pm    
ahaan! thnks

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