【发布时间】:2014-04-25 07:05:11
【问题描述】:
我遇到文件下载失败,即 IE 无法通过 HTTPS 下载 PDF,如 here 所述。
解决方案非常简单,只需设置适当的缓存控件即可。我遇到的问题是,无论我将缓存控制标头设置为什么,它们都以相同的值显示。
这里是代码
context.Response.ClearContent()
context.Response.ClearHeaders()
context.Response.AppendHeader("Content-Disposition", String.Format("attachment;filename=RiskSummaryForm {0}.pdf", intSubno))
context.Response.ContentType = "application/pdf"
context.Response.AppendHeader("Cache-Control", "no-store, no-cache, must-revalidate")
context.Response.AppendHeader("X-Footest", "no-store, no-cache, must-revalidate")
'context.Response.AppendHeader("Pragma", "token")
'context.Response.Cache.SetCacheability(HttpCacheability.Private)
Dim Doc As Document = GACIS.PRB.Doc.RiskSummaryForm.GetPDF(context, DocumentDataFormat.Binary)
context.Response.OutputStream.Write(Doc.DataBinary, 0, Doc.DataBinary.Length)
HttpContext.Current.ApplicationInstance.CompleteRequest()
这是 Fiddler2 的原始标头:
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Pragma: no-cache
Content-Type: text/html
Expires: -1
Server: Microsoft-IIS/7.5
Content-Disposition: attachment;filename=RiskSummaryForm 300185.pdf
X-Footest: no-store, no-cache, must-revalidate
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Sat, 04 Jan 2014 00:19:01 GMT
Content-Length: 78193
无论我如何更改缓存,结果始终是 Cache-Control: no-cache, no-store 和 Pragma: no-cache。
什么可能会重置缓存标头?
【问题讨论】:
标签: internet-explorer caching https file-transfer