AllExperts > Experts 
Search      

Active Server Pages Programming (ASP)

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Active Server Pages Programming (ASP) Answers
Question Library

Ask a question about Active Server Pages Programming (ASP)
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
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

Experience
ASP, COM, SQL SERVER 2000, .NET, SMS, MOM, Crstal Reports, MsProject, BizTalk Serve, Sharepoint Portal Server, Oracle D2K

 
   

You are here:  Experts > Computing/Technology > Business Software > Active Server Pages Programming (ASP) > Prevent going back to previous page

Topic: Active Server Pages Programming (ASP)



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.

Regards
Ujjwal

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.