亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

設(shè)置ASP.NET頁(yè)面不被緩存(客戶端/服務(wù)器端取消緩存方法)

 更新時(shí)間:2013年06月24日 16:18:09   作者:  
設(shè)置頁(yè)面不被緩存:客戶端取消緩存、服務(wù)器具端取消緩存的具體實(shí)現(xiàn)代碼如下感興趣的朋友可以參考下哈,希望對(duì)大家有所幫助
復(fù)制代碼 代碼如下:

/// <summary>
/// 設(shè)置頁(yè)面不被緩存
/// </summary>
private void SetPageNoCache()
{
Response.Buffer = true;
Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
Response.Expires = 0;
Response.CacheControl = "no-cache";
Response.AppendHeader("Pragma", "No-Cache");
}

1、取消緩存
(2)客戶端取消
復(fù)制代碼 代碼如下:

<html>
<head>
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
</head>

(3)服務(wù)器具端取消:
服務(wù)器端:
復(fù)制代碼 代碼如下:

Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
Response.Expires = 0;
Response.CacheControl = "no-cache";
Response.Cache.SetNoStore();

Global里面:
復(fù)制代碼 代碼如下:

protected void Application_BeginRequest(Object sender, EventArgs e)
{
HttpContext.Current.Response.Cache.SetNoStore();
}
<%@ OutPutCache Location="None"%>

頁(yè)面基類:
復(fù)制代碼 代碼如下:

public class PageBase : Page
{
public PageBase() {}
protected override OnLoad( EventArgs e ) {
Response.Cache.SetNoStore();
base.OnLoad();
}
}

最簡(jiǎn)單的辦法 :-)
學(xué)CSDN的這個(gè)論壇,在URL后面隨機(jī)的加一些沒用的參數(shù),比如:
http://xxx/xxx/xxx.jpg?p=xxx
IE是用過URL來(lái)控制緩存的,這樣就解決了

相關(guān)文章

最新評(píng)論