Summary of methods for disabling page caching asp.net

Source: Internet
Author: User

  This article mainly describes the ASP.net disable page caching method, the need for friends can refer to the following

1, in the ASP page header <head> add       code as follows:   Response.Buffer   =   True       RESPO Nse. ExpiresAbsolute   =   Now ()  -  1       response.expires   =   0   &NB Sp   Response.CacheControl   =   "No-cache"       response.addheader   "Pragma",   "N O-cache "    2, add   code in HTML code as follows:   <HEAD>       <meta   http-equiv=" pragm A "  content=" No-cache ">       <meta   http-equiv=" Cache-control "  content=" No-cache ">       <meta   http-equiv=" Expires "  content=" 0 ">       </h Ead>     3, in the recall of the original page when the page passed a parameter   href= "****.asp?random ()"    the first two methods are said to be sometimes ineffective, And the third is to pass a random parameter in the jump! Because the cache of ASPX is related to parameters, caching is not used if the parameters are different, and the page is regenerated, and a random parameter is used to avoid caching each time. This applies only to Asp&asp.net     4, Window.location.replace ("WebForm1.aspx"); &nbThe sp;  parameter is the page you want to overwrite, and the replacement principle is to replace the page specified by the Replace parameter with the current page.    This prevents users from clicking the Back button. The JavaScript script is used, for example:   a.html     code as follows: <html>      <head>          <title>a</title>               <script language= "ja Vascript ">              function jump () {            &N Bsp     Window.location.replace ("b.html");             }      &NB Sp   </script>      </head>      <body>        &NBS P;<a href= "Javascript:jump ()" >b</a>     </body>  </html>    The first 3 types just empty the cache, that is, temporary files stored in the Temporary Internet Files folder, and the 4th is replacing the current paging file with the jump paging file and not emptying the cache, which means temporary the internet The files generate the associated temporary file.  

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.