本文介绍了添加代码4从高速缓存中删除页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其中添加了以下代码.在AddHeader中,对所有固定的"Pragma"是固定的

var lastModified = DateTime.UtcNow;
var expires = lastModified-TimeSpan.FromDays(365);
Response.Cache.SetExpires(expires);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.CacheControl =无缓存";
Response.AddHeader("Pragma","no-cache");

where the following code is added .in AddHeader what is "Pragma" is it fixed for all

var lastModified = DateTime.UtcNow;
var expires = lastModified - TimeSpan.FromDays(365);
Response.Cache.SetExpires(expires);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");

推荐答案

写道:​​

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Response.Cache.SetCacheability(HttpCacheability.NoCache);



我相信,仅靠它自己就能解决问题.无论哪种方式,无论将其放在哪里,都可以将所有这些代码放在页面中或您使用的基类中.



by itself will fix the problem, I believe. Either way, putting all this code somewhere in your page, or in a base class that you use, will work, no matter where you put it.


<html>

<head>

<meta HTTP-EQUIV="REFRESH" content="5">
<title>New Title </TITLE>
</head>

<body>
Blah !! Blah !! Blah !! Blah !! Blah !!
</body>

<head>

<meta HTTP-EQUIV="PRAGMA" content="NO-CACHE">
</head>

</html>



:)



:)


这篇关于添加代码4从高速缓存中删除页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 01:34