I have created a website. I login with username and password and after authenticating i redirect the user to Home Page. When the user clicks Logout, they are redirected to the Login Page. But after this when i click the BACK button on the browser, it again goes back to the Home Page with that user's login credentials. I have used Session["username"]=null in the Page_Load function of Home Page. How to avoid going back to the Home Page when the BACK button is clicked by the User??
views:
197answers:
3
A:
Most of the times browser back button did not get data from server it usually get it form browser cache. I think you should try removing page from browser cache on logout event,it will solve your problem automatically.
try this http://forums.asp.net/t/1329607.aspx
Regards.
Shoaib Shaikh
2010-03-31 05:46:25
Thanks a lot!!!!!!! It's Working :-)
Vinodh Kumar
2010-03-31 06:20:19
+1
A:
Hi Vinodh,
behind logout button code body use FormAuthentication.SignOut()
it remove tickets from authentication.
the page render on clicking back button but when user perform any task on that page and click on button or any thing which take postback not allow him to submit anything and redirect him to desire page.
if you got your answer click my answer and vote my answer,thanx
Emaad Ali
2010-03-31 05:46:38
while if you are using sessions then you can check the session value is it null or not.if null then redirect to desire page.perform that work in pageload.
Emaad Ali
2010-03-31 05:48:02
+1
A:
Try adding the following code to your homapage Page_load
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetNoStore();
Shoban
2010-03-31 05:53:09