Cannot open xls file in IE

2019-04-24 07:07发布

问题:

We have JSF web application that generates XLS file and gives user link to thes file.
All works fine if access this file via HTTP.
But IE(8) cannot open/save this xls file via HTTPS.
There is following error message:

Internet Explorer cannot download ...466088C5C313F92808BDB0AFF3447 from testhost.

Internet Explorer was not able to open this Internet site.  The requested site is either unavailable or cannot be found.  Please try again later.

I can open the same document via HTTPS in Firefox and in Chrome.
What can be the problem with IE?

Headers:

HTTP/1.1 200 OK
Date: Fri, 18 Jun 2010 14:45:42 GMT
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1
X-UA-Compatible: IE=EmulateIE7
Last-Modified: Fri, 18 Jun 2010 14:45:11 GMT
Cache-control: max-age=0, no-store, no-cache
Pragma: no-cache
Expires: 0
Content-Type: application/vnd.ms-excel
Content-Length: 6656
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive

回答1:

According to http://support.microsoft.com/kb/316431 , you should remove any of these HTTP headers you use:

Pragma: no-cache
Cache-control: no-cache,max-age=0,must-revalidate


回答2:

Most likely cause is the http response headers, which we had to configure specifically for xls files under ssl

Expires: Mon, 26 Jul 1997 05:00:00 GMT
Last-Modified: Fri, 18 Jun 2010 16:22:07 GMT
Cache-Control: cache, must-revalidate
Pragma: public

for the cache control and

Content-Type: application/vnd.ms-excel
Content-Disposition: attachment; filename="ExcelDownload.xls"
Content-Transfer-Encoding: binary
Content-Length: <fileSize>

for the content

The key entry is Pragma: public



回答3:

Do you have Cache Control set to no-cache? I ran into a similar problem. See this question and answer for details.