HOW TO: Prevent Web Caching in Windows 2000 (311006)
The information in this article applies to:
- Microsoft Windows 2000 Server
This article was previously published under Q311006 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:
- In the Internet Information Services snap-in, select the Web site, virtual directory, directory, or file for which you want to set content expiration.
- Right-click the Web site, virtual directory, directory, or file and select Properties.
- On the HTTP Headers property sheet, select Enable Content Expiration.
- 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:
- Open the ASP file in the editor of your choice.
- 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"
%>
back to the top
REFERENCESFor 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
189409 INFO: Controlling the Caching of Web Pages with IIS 4.0
234067 HOWTO: Prevent Caching in Internet Explorer
For more information, see the following Web sites:
back to the top
Modification Type: | Major | Last Reviewed: | 10/23/2003 |
---|
Keywords: | kbhowto kbHOWTOmaster KB311006 kbAudITPro |
---|
|