BeetleDev.com
info
contact
Friday, September 10, 2010
Beetle Blog
How to prevent page caching
By: douglas - Misc - 4/18/2003 12:00:00 AM

In order to prevent your page from caching in your visitor's browser, you can try these methods:

Write meta tags into your HTML header. Set the "expires" date to some date before today's date:

<meta http-equiv="no-cache">
<meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">

Using ASP:

< %
Response.ExpiresAbsolute = #2000-01-01#
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control", "private, no-cache, must-revalidate"
%>

Using ASP.net (C#):

Add these lines of code to the Page Load method:

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetAllowResponseInBrowserHistory(false);

.net code from http://www.dotnetbips.com/displayarticle.aspx?id=288


Last Modified: 4/26/2005 12:14:28 PM

Beetle Blog v0.2.2


Copyright © 1997 - 2010 BeetleDev.com. All rights reserved.