About Ujjwal Expertise Six ASP Objects, ASP and Database Coding, Stored Procedure, EMail, Printing in ASP, VBScript, WebServer(IIS) Configuration, Active X Programming, Session Variable, Application Variables, Cookies, Global.ASA
Expert: Ujjwal Date: 5/18/2005 Subject: Prevent going back to previous page
Question i dont seem to be able to use the httpresponse.expires successfully. How does it work? How do i use it? i've tried using response.cache.setexpires(datetime.now.add(10)) to set a timeout in 10mins and it dont work either.
Thanks for replying!
-------------------------
Followup To
Question -
Yes that will partially help. But what if i explicitly wants to delete all related cache? or if there a way that my sites doesn't produce cache at all? i just don't want ppl to still be able to go back to the previous page after they have log out.
-------------------------
Followup To
Question -
I believe a million people have already asked what i'm about to ask, but i don't seem to be able to find the answer online.
I'm building a .NET based login pages and was wondering how do i prevent users from going back to the previous page by clicking the back button. When i've logged out of my secured pages, using FormsAuthentication.SignOut() , i'm still able to reach the secured pages by clicking on back. I've noticed that some other secure sites like yahoo mail and hotmail have done it successfully. When user click on the back button, a message saying ' the session has already expired' kind of stuff.
How do you achieve that using ASP.NET ?
Answer -
Use HttpResponse.Expires Property
It will set the number of minutes before a page cached on a browser expires.
If you/user return to the same page before it expires, the cached version will be displayed.
Visit this URL also: http://www.mnot.net/cache_docs/
Answer -
in META Tags, specify NO-CACHE. This would help not to cache the Page.
Regards
Answer Hi,
You have to use it as:
Response.Cache.SetExpires(DateTime.Now.AddMinutes(10))
You have used it as Response.Cache.SetExpires(DateTime.Now.Add(10)) - This is for, Adding the value of the specified System.TimeSpan to the value of this instance.