Response.expires

zhaozj2021-02-16  112

By default, the ASP prohibits the booff features of the browser and proxy. If you do not update each time, you should open the browser and agent buffer, which will allow the browser and the agent to use the "buffer" copy data for this page for a while. Buffering can greatly reduce the server's data reprint, and improve user browsing performance.

Which categories of dynamic pages are suitable for cache? Here are some examples:

Weather page, updated every 5 minutes

News or version list page, updated 2 times a day

Note: After using the browser or the agent, the number of clicks of the web server will be reduced. If you want to know all the pages, or for post ads, it is not suitable for using your browser and proxy cache.

The browser cache is controlled by the HTTP "Expires" header, which is sent to the browser by the web server. ASP provides 2 simple ways to send this header parameter. Settings Page In the future, you can use the response.expires properties. The following example will tell the browser to expire after 10 minutes: <% response.expires = 10%>

Setting response.expires is negative or 0, it is disabled. The settings for the second attribute Response.expireSabsabsAbsolute allows you to expire when a special time comes.

<% Response.expiresabsolute = #may 31,2001 13:30: 15 #%>

In addition to using the Response object to set the expiration time, you can also write tag at the HTML file header. Although the agent will not pay attention to this tag, some browsers can.

Finally, for HTTP proxy, use response.cacheControl to indicate whether to cache content. Set the properties to "public" to open the agent cache content.

<% Response.cachecontrol = "public"%>

By default, this attribute is set to "private". Note: Do not let the agent buffer those that are displayed to a particular user, because the agent may send a page belonging to other users to the current user.

转载请注明原文地址:https://www.9cbs.com/read-8338.html

New Post(0)