asp.net disable Page Caching method Summary _ Practical Tips

Source: Internet
Author: User

1, in the ASP page header

Copy Code code as follows:

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

2, in the HTML code to join
Copy Code code as follows:

<HEAD>
<meta http-equiv= "Pragma" content= "No-cache" >
<meta http-equiv= "Cache-control" content= "No-cache" >
<meta http-equiv= "Expires" content= "0" >
</HEAD>

3, in the back of the original page when the page passed a parameter href= "****.asp?random ()"
The first two methods are said to be sometimes ineffective, while the third is to pass a random parameter on 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");
The parameter is the page you want to overwrite, and the principle of replace is to substitute the page specified by the Replace parameter with the current page.
This prevents the user from clicking the Back button. The JavaScript script is used, for example:

A.html

Copy Code code as follows:



<title>a</title>
<script language= "JavaScript" >
Function jump () {
Window.location.replace ("b.html");
}
</script>

<body>
<a href= "Javascript:jump ()" >b</a>
</body>


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.