Response. Expires attributes (reproduced in the BLOG of crazy customers), response. expires

Source: Internet
Author: User

Response. Expires attributes (reproduced in the BLOG of crazy customers), response. expires

Expires attributes
The Expires attribute specifies the time before the page cached on the browser Expires. If you return to this page before a page expires, the buffer version is displayed.

Syntax
Response. Expires [= number]

Parameters
Number
The number of minutes before the expiration date. Set this parameter to 0 to immediately expire the cached page.


Note
If this attribute is set multiple times on one page, the shortest time is used.

Apply
Response object

Response. expires = 0 also indicates immediate expiration. However, if the client and server are not in the same time zone or the client time is earlier than the time on the server, it cannot immediately expire. Therefore, the system uses a negative number or Response. ExpiresAbsolute = now ()-1 to indicate immediate expiration. response. expires = 1 indicates expiration in 1 minute.

By default, ASP disables browser and proxy caching. If there is a page that is not updated each time, you should open the browser and Proxy Buffer, which will allow the browser and proxy to copy data using the "buffer" of the page for a period of time. Buffering can greatly reduce the amount of data reposted on the server and improve the browsing performance of users.

What types of dynamic pages are suitable for caching? The following are some examples:
The weather page. The news or version list page is updated every five minutes. The page is updated twice a day.
Note: After the browser or proxy is used for caching, the number of clicks on the Web server is reduced. If you want to know all pages accurately or for postal advertisements, it is not suitable to use browsers and proxy cache.

Browser cache is controlled by the HTTP "Expires" header parameter, which is sent to the browser by the Web server. ASP provides two simple methods to send this header parameter. Set the page to expire in a certain period of time in the future. You can use the Response. Expires attribute. The following example tells the browser that the content will expire after 10 minutes: <% Response. Expires = 10%>


  
If Response. Expires is set to negative or 0, the cache is disabled. The setting of 2nd attributes Response. ExpiresAbsolute allows you to specify that the content expires when a special time arrives.

<% Response. ExpiresAbsolute = # May 31,2001 13:30:15 # %>


In addition to setting the expiration time using the Response object, you can also write the <META> tag in the HTML file header. Although the proxy does not notice this mark, Some browsers can.
<META HTTP-EQUIV = "Expires" VALUE = "May 31,2001 13:30:15">


Finally, for the HTTP proxy, use Response. CacheControl to indicate whether the content is cached. Set the property to "Public" to enable the proxy cache content function.
<% Response. CacheControl = "Public" %>


By default, this attribute is set to "Private. Note: Do not let the Proxy Buffer the pages displayed to specific users, because the proxy may send the pages belonging to other users to the current user.


ResponseExpires = 0

Generally, when a user requests a WEB server, the server returns the request to the client. On the client side, the browser uses cache as a speed-up policy, that is, when a request is sent, the browser checks the cache first. If yes, the browser directly calls the cache instead of requesting the server.
In WEB programming, sometimes in order to prevent repeated submission or strict order, user data must expire immediately after use, when the user moves back, the system displays an expiration date and cannot be used again. This is also a security consideration.
In general, response. expires is written at the top of the page, followed by a time, that is, the expiration time. 0 indicates that it expires immediately.

ResponseExpiresAbsolute statement

Brother, this code is normal for me. It is estimated that there is a problem with your machine settings. You didn't post detailed error information, so I couldn't tell where the error was.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.