【发布时间】:2012-02-09 19:59:47
【问题描述】:
所以我在 IE 7 能够从 MVC 3 中内置的 SSL 站点下载文件时遇到问题。要让 IE 7 能够从 SSL 站点保存文件,它必须是可缓存的。
方法的代码是:
[OutputCache(Location = OutputCacheLocation.ServerAndClient, Duration = 20, VaryByParam = "none", NoStore = true )]
public override FileContentResult Export(int? id, string extra)
{
...
return new FileContentResult(byte[], mimetype);
}
这适用于 IE9、Chrome、Safari 和 Firefox。 我尝试了 VaryByParam、Duration 和 NoStore 的各种设置。当我更改任何这些设置时,响应标头似乎永远不会改变。
Cache-Control:no-cache, no-store, must-revalidate
内容配置:附件;文件名=PersonalInfo-02092012.xlsx
内容长度:11933
Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
日期:格林威治标准时间 2012 年 2 月 9 日星期四 18:16:35
过期:-1
Pragma:no-cache
服务器:Microsoft-IIS/7.5
任何帮助将不胜感激。
【问题讨论】:
-
有趣 - 不知道这里的 IE 行为。我现在回避 IE 的另一个原因:support.microsoft.com/kb/323308
标签: asp.net-mvc-3 caching attributes