Preventing a Page from Caching
Written by Eric Smith, Northstar Computer Systems LLC
In a previous tip, you learned about the Expires property of the Response object and how it can be used to “expire” your page. This would, in theory, prevent a browser or proxy server from caching the page. However, it doesn’t always work. A more reliable way to do it involves sending additional headers with the HTML page, using the following code:
<%
Response.Expires = 0
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>
While this is also not guaranteed to work, it will work on more systems than the Response.Expires will by itself.
Keywords: [
Uncategorized ASP Tips
]
Publication Date: 10/1/1999
|