Article ID: 311006 - Last Review: October 23, 2003 - Revision: 2.3

HOW TO: Prevent Web Caching in Windows 2000

This article was previously published under Q311006

On This Page

Expand all | Collapse all

SUMMARY

This step-by-step article describes how to prevent the Web caching of objects on your server.


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.


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 = 0
    Response.Expiresabsolute = Now() - 1
    Response.AddHeader "pragma","no-cache"
    Response.AddHeader "cache-control","private"
    Response.CacheControl = "no-cache"
    %>
    					



REFERENCES

For additional information on controlling Web page caching, click the article numbers below to view the articles in the Microsoft Knowledge Base:
165150  (http://support.microsoft.com/kb/165150/EN-US/ ) How to Use Pragma: No-cache with IIS and IE
234067  (http://support.microsoft.com/kb/234067/EN-US/ ) 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/ (http://www.mnot.net/cache_docs/)

Web Caching and Content Delivery Resources
http://www.web-caching.com (http://www.web-caching.com/)


APPLIES TO
  • Microsoft Windows 2000 Server
Keywords: 
kbhowto kbhowtomaster KB311006
 

Article Translations

 

Related Support Centers