tags:

views:

448

answers:

8

Is there a command in classic ASP I can use to tell the browser not to pull the page from it's cache, or, to not cache, or clear the cache of my page?

A: 

If you put

Response.Expires = -1

in you classic ASP-page it will instruct the browser not to cache the contents. If the user clicks "back" or navigating to the page in another way, the browser will refresh the page from the server.

Espo
+2  A: 

Here is a good article on how to do it across browsers.

http://www.htmlgoodies.com/beyond/reference/article.php/3472881

AaronS
A: 

Add the following meta tags to the HTML of the page. They instruct the browser to get the content from the origin server.

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
Wayne
+2  A: 

Not asp related, this is a HTTP question. You do it by modifying some aspect of http caching like Cache-Control, etag, Expires etc. Read RFC2616 especially Caching in HTTP and set the appropriate header.

Florian Bösch
+8  A: 

You can use HTML meta tags:

<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="Fri, 01 Jan 1999 1:00:00 GMT" />
<meta http-equiv="Last-Modified" content="0" />
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />

Or you can use ASP response headers:

<% 
   Response.CacheControl = "no-cache"
   Response.AddHeader "Pragma", "no-cache"
   Response.Expires = -1
%>
Forgotten Semicolon
A: 

Because of the way that different browsers handle caching both the Expires and the no-cache commands need to be used. Here is an article showing the correct way to do this.

WolfmanDragon
+1  A: 

Ignore everybody telling you to use <meta> elements or Pragma. They are very unreliable. You need to set the appropriate HTTP headers. A good tutorial on how to decide which HTTP headers are appropriate for you is available here. Cache-Control: no-cache is probably all you need, but read the tutorial as there are many project-specific reasons why you might want something different.

Jim
Thank you for the link Jim; interesting scan, I will dive in later.
Brettski
A: 

Can be done by making sure that you have correct values set for Reponse.cachecontrol, response.expires etc according to your need. This link may be helpful in understanding what they mean. http://aspjavascript.com/lesson07.asp

Aravind