Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: IIS4.IIS5
Expertise: Intermediate
Sep 4, 2001

Prevent the browser from caching an ASP page

Most ASP books and articles state that you need to set the Respose.Expires property to 0 or -1 to prevent the end user's browser from caching an ASP page. However, this is only partially correct, because in order to work correctly for all browsers brands and versions, you also need to add a special Pragma HTTP header, and to disable any caching by a proxy. This is the ASP code you should put on top of your page to achieve the desired behavior:

' WARNING: you should run these statement before sending any HTML to the user.
' if in doubt, use Respose.Buffer = True to buffer all html 

Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1

Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap