HOW TO: Prevent Web Caching in Windows 2000

Article translations Article translations
Article ID: 311006 - View products that this article applies to.
This article was previously published under Q311006
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

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 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

Properties

Article ID: 311006 - Last Review: October 26, 2013 - Revision: 3.0
Applies to
  • Microsoft Windows 2000 Server
Keywords: 
kbnosurvey kbarchive kbhowto kbhowtomaster KB311006

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com