HOW TO: Prevent Web Caching in Windows 2000

This article was previously published under Q311006
This article has been archived. It is offered "as is" and will no longer be updated.
Summary
This step-by-step article describes how to prevent the Web caching of objects on your server.

back to the top

Enable Content Expiration in IIS 5.0

When content expiration is enabled, the Web browser compares the current date to the expiration date to determine whether to display a cached page or request an updated page from the server.

To set the expiration of Web site content in IIS 5.0, follow these steps:
  1. In the Internet Information Services snap-in, select the Web site, virtual directory, directory, or file for which you want to set content expiration.
  2. Right-click the Web site, virtual directory, directory, or file and select Properties.
  3. On the HTTP Headers property sheet, select Enable Content Expiration.
  4. Select Expire Immediately, Expire after, or Expire on and enter the appropriate expiration information in the corresponding box.
NOTE: Typically, time-sensitive information is limited to individual files, directories, or Web sites; however, you can also set content expiration for all Web sites on a computer through the configuration of WWW Master Properties.

back to the top

Prevent Caching Using an ASP Script

You can also prevent individual pages from being cached by adding a script to ASP files. To do this, follow these steps:
  1. Open the ASP file in the editor of your choice.
  2. Add the following script to very top of the ASP file:
    <%Response.Expires = 0Response.Expiresabsolute = Now() - 1Response.AddHeader "pragma","no-cache"Response.AddHeader "cache-control","private"Response.CacheControl = "no-cache"%>					


back to the top
References
For additional information on controlling Web page caching, click the article numbers below to view the articles in the Microsoft Knowledge Base:
165150 How to Use Pragma: No-cache with IIS and IE
234067 HOWTO: Prevent Caching in Internet Explorer
For more information, see the following Web sites:
Caching Tutorial for Web Authors and Webmasters
http://www.mnot.net/cache_docs/

Web Caching and Content Delivery Resources
http://www.web-caching.com
back to the top
Properties

Article ID: 311006 - Last Review: 10/26/2013 07:33:00 - Revision: 3.0

  • Microsoft Windows 2000 Server
  • kbnosurvey kbarchive kbhowto kbhowtomaster KB311006
Feedback