c# - 在 iframe 中加载时清除 url 缓存

标签 c# javascript asp.net browser

我正在 iframe 中加载 url 内容。所以现在 url 信息会自动下载到用户的临时文件夹中。 我已经使用了以下代码:

<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">

如何避免所有浏览器的缓存? 在 iframe 中加载时如何避免 url 缓存?

需要你的建议和例子..

最佳答案

// Stop Caching in IE
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);

// Stop Caching in Firefox
Response.Cache.SetNoStore();

这些语句添加以下响应 header :

缓存控制:无缓存、无存储 编译指示:无缓存

还阅读了我在 ASP.NET 论坛中找到的这篇文章:

Use the following tags inside head tag of your page.

<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

Both the above tags should be included if you are not sure if server is HTTP/1.1 compliant. Also Include:-

<META HTTP-EQUIV="EXPIRES" 
CONTENT="Mon, 22 Jul 2002 11:12:01 GMT">  tells the server which cache the page to expire the page in given time interval. An invalid interval like "0" or "-1" expires it immediately and causes a fetch of latest version of file, each time request is made.

you can get complete info at this link :- http://www.i18nguy.com/markup/metatags.html

关于c# - 在 iframe 中加载时清除 url 缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8343171/

相关文章:

asp.net - Android C2DM 获取 (401) 未经授权

c# - iText 7.0.4.0 - PdfWriter 为某些 PDF 文件输入生成损坏的 PDF

c# - 更新绑定(bind)到它的 ObservableCollection 后,DataGrid 不会更新

javascript - JavaScript 可以帮助防止重复点击事件处理吗?

c# - ASP.NET Core 发布到 IIS 空白加载屏幕

c# - n层架构: best place to store business objects?

c# - 如何将此 JSON 反序列化为 C# 对象?

c# - 简单注入(inject)器容器无法从插入的外部库注册 Web API Controller

javascript - 在 Angularjs 中,我如何加载相同的 javascript 文件,但为不同的环境(测试、测试版、产品)传递不同的 key

javascript - 当触摸屏上出现 "pinches"时,如何防止IE全页缩放?