禁止頁面緩衝的方法 多語言下禁止頁面緩衝

來源:互聯網
上載者: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"
複製代碼

2、在html代碼中加入

複製代碼

3、在重新調用原頁面的時候在給頁面傳一個參數 Href="****.asp?random()"

前兩個方法據說有時會失效,而第三種則是在跳轉時傳一個隨機的參數!因為aspx的緩衝是與參數相關的,如果參數不同就不會使用緩衝,而會重建頁面,每次都傳一個隨機的參數就可以避免使用緩衝。這個僅適用於asp&asp.net

4、jsp頁面中禁用緩衝:

  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
複製代碼

這些代碼加在 中間:

  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. %>
複製代碼

5、window.location.replace("WebForm1.aspx"); 參數就是要覆蓋的頁面。

replace的原理:使用當前頁面替換掉replace參數指定的頁面。這樣可以防止使用者點擊back鍵。

javascript指令碼,舉例如下:a.html

  1. a
  2. b
複製代碼

b.html

  1. b
  2. a
複製代碼

6、php禁用頁面緩衝

  1. # 讓它在過去就“失效"

  2. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

  3. # 永遠是改動過的

  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");

複製代碼

>>> 您可能感興趣的文章:解析 PHP和瀏覽器緩衝機制php立即重新整理緩衝輸出的方法舉例php頁面緩衝的例子(減經cpu與mysql負擔)如何禁用aspx頁面的用戶端緩衝asp.net 取消緩衝的方法介紹asp.net 清除IE頁面緩衝的方法清除IE緩衝的方法匯總(asp asp.net php等)asp 清除IE緩衝的方法介紹php禁止頁面緩衝輸出的代碼php禁止頁面緩衝的代碼一個php禁止頁面緩衝的函數防止IE緩衝jsp檔案的方法ASP.NET緩衝的方法分析asp.net效能最佳化方法-快取資料和頁輸出

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.