Response.CacheControl

dfeprod - 17 mai 2001 à 14:21
 jeromax - 23 mai 2001 à 11:05
:question) a quoi sert cette ligne et est-elle utile sous PWS de 98SE

1 réponse

Voila ce que dit le MSDN (bonne traduction ;) ):

Allowing Proxy Servers to Cache Pages
Your application may be sending pages to a client through a proxy server. A proxy server acts on behalf of client browsers to request pages from Web sites. The proxy server caches HTML pages so that repeated requests for the same page can be returned quickly and efficiently to the browsers. Having the proxy server process requests and cache pages reduces the load on the network and on the Web server.

While caching works well for many HTML pages, it often does not work well for ASP pages that contain dynamically generated information. For example, pages that report stock market prices or display inventory for a high-volume business must provide timely information. Information that is even one hour old might not be accurate enough. If your application returns personalized information, such as a custom home page, you want to ensure that no user sees another user's personal information.

By default, ASP instructs proxy servers not to cache the ASP page itself (although images, image maps, applets, and other items referenced from the page are cached). You can allow caching for certain pages by using the Response.CacheControl property to set the Cache-Control HTTP header field. The default value of Response.CacheControl is the string "Private," which prevents proxy servers from caching the page. To allow caching, set the Cache-Control header field to Public:

<% Response.CacheControl = "Public" %>
Because HTTP headers must be sent to the browser or proxy before any page content is sent, either put the Response.CacheControl property before any HTML tags or, if you have disabled buffering, use Response.Buffer to buffer the page.

The Cache-Control header field is part of the HTTP 1.1 specification. ASP pages are not cached on proxies that support only HTTP 1.0 because no Expires header field is sent.
0
Rejoignez-nous