导出到Excel不适用于SSL下的IE(https)

我一直在尝试在安全的网站(https)上修复一些东西,这是一个导出到Excel按钮,生成一个CSV文件。

它适用于Firefox,Chrome等…但不适用于Internet Explorer。

我更改了标头消除了无缓存,并编辑了IIS http标头配置设置的截止日期为1天。

我不知道会发生什么以及如何解决它。

你们有没有想过如何解决这个问题? 我读过这么多post,他们都说同样的话……缓存。

谢谢,

更新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。

Microsoft将IE更改为不自动转换纯文本文件(例如CSV)。 您必须发送正确的MIME类型。 不过,我没有这方面的信息。

在过去遇到过IE和ssl的问题时,我发现了以下标题

 Cache-Control: cache, must-revalidate Pragma: public Content-Type: application/vnd.ms-excel // MIME type Content-Disposition: attachment; filename="excelDownload.xls" Content-Transfer-Encoding: binary Content-Length: 1024 // size as appropriate 

为我工作(除了通常的Expires和Last Modified标头)

我的解决方案与之前的人(TGuv)非常相似。 我删除了以下代码行,它工作正常:

 Response.Cache.SetCacheability(HttpCacheability.NoCache); 

添加请求参数,它将工作 –

 response.setHeader("Expires", "0"); response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); response.setHeader("Cache-Control", "max-age=30"); response.setHeader("Pragma", "public"); response.setContentType("application/docx"); 

我们在工作中遇到了这个问题,结果certificate是Internet Explorer中的一个错误(在我们的例子中是IE8-),在尝试使用SSL下载文件时会出错。 问题是,如果服务器向浏览器发送禁用缓存的http标头,则Explorer会出错。

解决方案服务器端是您应该覆盖此标头以告知IE8缓存响应,例如Cache-Control: private 。 请注意, no-cache="Set-Cookie"时,某些应用程序服务器(例如我们的Websphere Application Server)会自动附加no-cache="Set-Cookie"

最后,还有另一个解决问题的解决方案(如果适用),但应该在浏览器的客户端应用:

请查看方法1: http : //support.microsoft.com/kb/2549423