Disable page Caching methods disable page caching in multiple languages

Source: Internet
Author: User
    1. Response.Buffer = True
    2. Response.ExpiresAbsolute = Now ()-1
    3. Response.Expires = 0
    4. Response.CacheControl = "No-cache"
    5. Response.AddHeader "Pragma", "No-cache"
Copy Code

2. Add in HTML code

Copy Code

3, in the recall of the original page when the page passed a parameter href= "****.asp?random ()"

The first two methods are said to sometimes fail, and the third is to pass a random parameter when jumping! Because the ASPX cache is parameter-dependent, the cache is not used if the parameters are different, and the page is regenerated, and a random argument is passed each time to avoid using the cache. This applies only to Asp&asp.net

4. Disable caching in JSP pages:

    1. Response.setheader ("Cache-control", "No-cache"); HTTP 1.1
    2. Response.setheader ("Pragma", "No-cache"); HTTP 1.0
    3. Response.setdateheader ("Expires", 0); Prevents caching at the proxy server
Copy Code

These codes are added in the middle:

    1. <%
    2. Response.setheader ("Cache-control", "No-cache"); HTTP 1.1
    3. Response.setheader ("Pragma", "No-cache"); HTTP 1.0
    4. Response.setdateheader ("Expires", 0); Prevents caching at the proxy server
    5. %>
Copy Code

5, Window.location.replace ("WebForm1.aspx"); The parameter is the page to overwrite.

Replace principle: Replaces the page specified by the Replace parameter with the current page. This prevents the user from clicking the back key.

JavaScript scripts, for example, are as follows: a.html

    1. A
    2. B
Copy Code

B.html

    1. B
    2. A
Copy Code

6. PHP Disables page caching

    1. # to make it "fail" in the past

    2. Header ("Expires:mon, Jul 1997 05:00:00 GMT");

    3. # It's always been a change #

    4. Header ("last-modified:". Gmdate ("D, D M Y h:i:s"). " GMT ");

    5. # http/1.1

    6. Header ("Cache-control:no-store, No-cache, must-revalidate");
    7. Header ("Cache-control:post-check=0, pre-check=0", false);

    8. # http/1.0

    9. Header ("Pragma:no-cache");

Copy Code

>>> you may be interested in the article: parsing PHP and browser caching mechanisms PHP instantly refreshes the cache output Method Example PHP page cache examples (minus the CPU with MySQL burden) How to disable the client cache for ASPX pages ASP. Methods of canceling caching introduction to the method of clearing IE page cache by ASP (ASP ASP. NET PHP, etc.) ASP The method of clearing IE cache to introduce PHP prohibit page cache output code PHP prohibit page cache code a PHP disable page caching function prevent IE cache jsp file methods ASP. NET caching Method analysis ASP. NET performance Optimization method-cache data and page output

  • 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.