1. 程式人生 > >asp.net/html清理瀏覽器快取最為簡單有效方法

asp.net/html清理瀏覽器快取最為簡單有效方法

第一種方法:在頁面載入方法裡新增以下程式碼:

            Response.Buffer = true;
            Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
            Response.Expires = 0;
            Response.CacheControl = "no-cache";
            Response.AddHeader("Pragma", "No-Cache");

第二種方法:在設計頁面新增以下程式碼:

        <HEAD>


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