ASP Clean Cache Code _ Application Tips

Source: Internet
Author: User
Tags comments
Copy Code code as follows:

Response.Buffer = True

' Generally, when a user requests a Web server, the server replies the request to the client. On the client side, the browser takes caching as a speed-checking strategy, which is to check the cache when the request is made, and if there is a direct cache, do not request the server.
' In web programming, sometimes in order to prevent repetitive submissions or strict orders, the user's data must expire immediately after use, and when the user goes back, the display expires and cannot be used. Generally, Response.Expires is written at the top of the page, followed by the expiration of the time, 0,-1 said immediately expired.
' ASP does not have multiline comments, only comments per line, up to the beginning of the comment content can be more, such as this 3 line comments, these 3 lines comment the following line.
' Response.Expires browser can cache the length of time for the current page in minutes.

Response.Expires =-1

' Response.ExpiresAbsolute browser can no longer cache the date and time of the current page. Can be returned before it expires. If no time is specified, the home page expires at midnight on the same day, and if no date is specified, the specified time of day expires.

Response.ExpiresAbsolute = Now ()-1
Response.Expires = 0

' Response.CacheControl indicates whether the proxy server can cache activeserverpage. By default, its value is false. When you set its properties to public, the proxy server can buffer the output generated by the ASP.
' Cache-control Specifies the caching mechanism that the request and response follow. Setting Cache-control in a request message or in a response message does not modify the caching process during another message handling process.
' No-cache indicates that the request or response message cannot be cached

Response.CacheControl = "No-cache"

' Above 4 lines of ASP meaning: We are in the database to add operations, if we allow back, and just happened to refresh the page, it will be added again, no doubt this is not what we want, prohibit the caching of code, sometimes unreliable, then you just in the operation of the page to add on it.
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: 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.