3

I've got a caching problem with the Internet Explorer 6.0 and I want to instruct the browser not to cache the page he's requesting.

Further information: In my page, there's a random token that prevents reloading the site and posting the same information twice or more.

If you now bookmark this page, the browser has to be instructed to refresh the site, everytime he requests it.

Firefox 3.0.5 does this correctly, but IE 6.0 keeps the random token in cache.

I included following meta tags in the affected page:

<meta http-equiv="cache-control" content="no-cache, must-revalidate">
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">

Any ideas? Thanks in advance!

bignose
  • 30,281
  • 14
  • 77
  • 110
guerda
  • 23,388
  • 27
  • 97
  • 146

2 Answers2

4

This is a fairly well documented googleable problem, and probably duped several times here, but fwiw this is my standard block (C#):

Response.AppendHeader("Cache-Control", "no-cache"); //HTTP 1.1
Response.AppendHeader("Cache-Control", "private"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "no-store"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "must-revalidate"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "max-stale=0"); // HTTP 1.1 
Response.AppendHeader("Cache-Control", "post-check=0"); // HTTP 1.1 
Response.AppendHeader("Cache-Control", "pre-check=0"); // HTTP 1.1 
Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.0 
Response.AppendHeader("Expires", "Wed, 09 Jun 1993 00:00:00 GMT"); // HTTP 1.0
annakata
  • 74,572
  • 17
  • 113
  • 180
  • 5
    -1, you should never send both `Cache-Control: no-cache` (telling everyone they can't cache) and `Cache-Control: private` (telling browsers that they _can_ cache). – Keith Oct 29 '12 at 12:07
0

Check what HTTP headers your server is sending, these can over ride what is in the meta section in the HTML.

Jeremy French
  • 11,707
  • 6
  • 46
  • 71
  • The meta section in the HTML isn't worth the bytes it takes to download - it's a purely optional set of tags that need not be processed by the browser. The cache headers in the response, however are not optional and do work. – Adam Hawes Feb 04 '09 at 12:59