HTTP/1.1 200 OK
Cache-Control: <CACHE SETTING>
Content-Length: <size of content>
Commonly-Used HTTP/1.1 Cache-Control Header ValuesThe HTTP/1.1 specification in RFC 2616 defines several values for the Cache-Control header. The following list contains a few of the more common values that are used.
- Public: The HTTP response may be cached by any cache. For example, either a client or a proxy server can cache the response. This allows sharing of content across users who are using the same proxy server.
- Private: The response message is intended for a single client and must not be cached by a shared cache. For example, a proxy server should not cache the response even though a client can. This allows the client to maintain a cached version, while other clients that are using the same proxy server maintain different cached versions.
- No-cache: No cache in the entire path should maintain a cached copy of the response. This allows you to specify that neither the client or proxy server will respond to a subsequent content request by using a cached version.
Setting the Cache-Control PropertyThe following examples define different methods for setting this value:
For a PageUsing Active Server Pages (ASP), the following ASP code disables caching of a particular page:
<% @Language="VBScript" %>
<% Response.CacheControl = "no-cache" %>
For a FolderThe following examples set the Cache-Control setting for a folder or virtual directory named "Images" in the default Web site:
- Using Adsutil.vbs:
- Open a command prompt and change to your C:\InetPub\AdminScripts folder.
- Run the following command:CSCRIPT ADSUTIL.VBS SET W3SVC/1/ROOT/images/CacheControlCustom "no-cache"
- Using ADSI Scripting:
- In Notepad, enter the following ADSI code:
Set objCache = GetObject("IIS://localhost/w3svc/1/root/images")
objCache.CacheControlCustom = "no-cache"
- Save the file as Disablefolder.vbs in your C:\InetPub\AdminScripts folder, and then close Notepad.
- At a command prompt, change to your C:\InetPub\AdminScripts folder.
- Run the following command:CSCRIPT DISABLEFOLDER.VBS
REFERENCESFor more information on this topic, please see the following Microsoft Knowledge Base article:
ID d'article : 247404 - Dernière mise à jour : 30 juil. 2008 - Révision : 1