我一直在尝试修复安全网站(https)上的某些问题,该网站是生成CSV文件的“导出到Excel”按钮。
它适用于Firefox,Chrome等...,但不适用于Internet Explorer。
我更改了标头,消除了无缓存
并且还编辑了IIS http标头配置,将有效期设置为1天。
我不知道会发生什么以及如何解决。
你们对如何解决这些问题有任何想法吗?我读了很多文章,他们都在说同样的事情……缓存。
谢谢,
更新1:
关于收到的错误,我收到IE警报,提示“ Internet Explorer无法从web.address.com下载filename.aspx。
Internet Explorer无法打开此Internet网站。请求的站点不可用或找不到。请稍后再试。
就像我说的那样,这一切都无法通过SSL(https)进行,但是导出到excel按钮会破坏https。
更新2:
我正在使用这些标题:
Response.ClearContent();
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment; filename=" + name.Trim() + ".csv");
Response.AddHeader("Cache-Control", "no-cache");
Response.AddHeader("Pragma", "public");
Response.AddHeader("Content-Transfer-Encoding", "binary");
Response.AddHeader("Content-Length", "2026");
Response.Charset = "";
//Response.ContentType = "application/vnd.ms-excel";
Response.ContentType = "text/csv";
最佳答案
问题是因为,在IE9之前,使用缓存控制标头(http://support.microsoft.com/kb/323308)时Internet Explorer下载无法通过SSL进行。
只需删除:Response.AddHeader("Cache-Control", "no-cache");
在IE 6,7&8的https中有效。