Welcome to WebmasterWorld Guest from 54.159.246.164

Forum Moderators: ocean10000

Message Too Old, No Replies

HTML code to deny cache of .asp webpages

   
9:03 am on Feb 17, 2009 (gmt 0)

10+ Year Member



hi

how should be the HTML code on the webserver to deny cache of .asp webpages?

is this correct?


<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />

but what are differencies between "pragma" and "Cache-Control" ?

1:18 pm on Feb 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Setting the headers is more reliable than using meta tags: see How (and how not) to control caches [mnot.net]

Meta tags are easy to use, but arenít very effective. Thatís because theyíre only honored by a few browser caches (which actually read the HTML), not proxy caches (which almost never read the HTML in the document). While it may be tempting to put a Pragma: no-cache meta tag into a Web page, it wonít necessarily cause it to be kept fresh.

Here's example ASP code from ASPFAQ [classicasp.aspfaq.com]


<%
Response.ExpiresAbsolute = #2000-01-01#
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control", "private, no-cache, must-revalidate"
%>
12:55 am on Feb 20, 2009 (gmt 0)

10+ Year Member



thanks a lot!

I'll try this code:


Response.Expires = 0
Response.ExpiresAbsolute = 0
Response.AddHeader "Pragma", "no-cache"
Response.AddHeader "cache-control", "no-store"
Response.AddHeader "cache-control", "private, no-cache, must-revalidate"

to prevent any kind of caching.

5:30 pm on Feb 22, 2009 (gmt 0)

10+ Year Member



is this code correct?
9:51 pm on Feb 22, 2009 (gmt 0)

10+ Year Member



could someone explain pls, what exactly private and must-revalidate means?
8:40 pm on Feb 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



[w3.org...]