Freigeben über


Response. CacheControl

You can set this property to “public” if you want to advise the proxy server to cache this asp page. By default, this property will be set to “private”. Usually ASP pages are developed to be unique for each user browsing the website. And that’s the reason why IIS is setting this property to be “private” as default. You can also change this setting if you want to improve the performance of your website.

Syntax

Response.CacheControl = [Value]

The following is a partial list of values supported by the HTTP/1.1 Protocol. For more complete descriptions, see the Hypertext Transfer Protocol, HTTP/1.1 specification of section 14.9 on the World Wide Web Consortium Web site.

Value

Private

A cache mechanism may cache this page in a private cache and resend it only to a single client. This is the default value. Most proxy servers will not cache pages with this setting.

Public

Shared caches, such as proxy servers, will cache pages with this setting. The cached page can be sent to any user.

No-cache

Do not cache this page, even if for use by the same client.

No-store

The response and the request that created it must not be stored on any cache, whether shared or private. The storage inferred here is nonvolatile storage, such as tape backups. This is not an infallible security measure.

I got this data from https://msdn2.microsoft.com/en-gb/library/ms524721.aspx

This property applies only if you have a proxy server in between the client and the web server. If not, this will be ignored. Generally all the ASP pages are cached in the proxy for the faster response time. For an example, you may host a website which displays a dynamic data such as stock price which will be changing time to time. It is not a good idea to cache this website in the proxy. To avoid caching of this website, you can set this property.

Example:

<% Response.CacheControl = "Private" %>

<HTML>

<BODY>

This page won't be cached in any of the proxy servers :-)

</BODY>

</HTML>