Asp.net clear cache disable page cache

Source: Internet
Author: User

Method 1: Add the following code in

 

  Response.Buffer   =   True     Response.ExpiresAbsolute   =   Now()   -   1     Response.Expires   =   0     Response.CacheControl   =   "no-cache"     Response.AddHeader   "Pragma",   "No-Cache"

Method 2: Add in HtML code

 <HEAD>     <META   HTTP-EQUIV="Pragma"   CONTENT="no-cache">    <META   HTTP-EQUIV="Cache-Control"   CONTENT="no-cache">   <META   HTTP-EQUIV="Expires"   CONTENT="0">     </HEAD>

Method 3: when the original page is re-called, Href = "*****. asp? Random ()"

The first two methods are said to be invalid sometimes, and the third is to pass a random parameter during the jump! Because the cache of aspx is related to parameters, if the parameters are different, the cache will not be used, but the page will be regenerated. If a random parameter is passed every time, the cache can be avoided. This only applies to asp & asp.net

Method 4: window. location. replace ("WebForm1.aspx ");

The parameter is the page to be overwritten. The replace principle is to replace the page specified by the replace parameter with the current page.

This prevents users from clicking the back key. The javascript script is used, for example:

    

The first three types only clear the cache, that is, Temporary Files stored in the Temporary Internet Files folder, and the second type is to use the jump page file to replace the current page file without clearing the cache, that is to say, Temporary Internet Files generate related Temporary Files.

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.