Internet explorer IE无法通过WebSphere提供的SSL下载文件
当用户试图通过https下载csv文件时,IE7和IE8都会抛出一个错误 Internet Explorer无法下载downloadPage.jsf。Internet Explorer无法打开此Internet站点。请求的站点不可用或找不到。请再试一次 我阅读了IE与缓存相关的问题,因此我更改了响应以允许公共缓存。见本期: 但我仍然得到这个错误 你知道还有什么会导致这个问题吗?以下是完整的片段:Internet explorer IE无法通过WebSphere提供的SSL下载文件,internet-explorer,jsf,websphere,download,Internet Explorer,Jsf,Websphere,Download,当用户试图通过https下载csv文件时,IE7和IE8都会抛出一个错误 Internet Explorer无法下载downloadPage.jsf。Internet Explorer无法打开此Internet站点。请求的站点不可用或找不到。请再试一次 我阅读了IE与缓存相关的问题,因此我更改了响应以允许公共缓存。见本期: 但我仍然得到这个错误 你知道还有什么会导致这个问题吗?以下是完整的片段: HttpServletResponse response = (HttpServletRespons
HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
response.setContentType("text/plain");
response.setHeader("Content-Disposition", "attachment; filename=\"" + browserFilename + "\"");
response.setHeader("Pragma", "public");
response.setHeader("Cache-Control", "public");
response.getOutputStream().write(contentBytes);
context.responseComplete();
我认为您使用缓存的方法是正确的: 这篇知识库文章可能会帮助您,
在这个堆栈溢出问题中提到:当响应中包含cookie时,WebSphere似乎会自动添加
缓存控制:no Cache=set cookie
响应头。IE8及更早版本在通过SSL下载时不喜欢这样
有两种可能的修复方法:
CookiesConfigureNoCache:false
(默认为true)
缓存控制
头,这将覆盖WebSphere set-one
response.addCookie(...);
response.addCookie(...);
...
response.setHeader("Cache-Control", ...);
我对IE8也有同样的问题。 我对代码做了一些小改动 Response.ClearHeaders()//需要,否则“无缓存:设置cookie”就存在,必须将其清除
addHeader(“缓存控制”、“专用”) 在将应用程序服务器配置为使用SSL时出现了完全相同的问题。打开https后让它工作的诀窍是:
string attachment = "attachment; filename=" + rptName + ".xls" + "";
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.AddHeader("content-disposition", attachment);
HttpContext.Current.Response.AddHeader("Cache-Control", "private, max-age=1");
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.Cache.SetExpires(DateTime.Now.AddMinutes(1));
以下是我在PHP代码中所做的工作:
header( "HTTP/1.0 200 OK" );
header( "Content-Disposition: inline; filename=$path" );
header( "Content-Type: attachment; application/pdf" );
header( "Content-Length: $info[7]" );
header( "Cache-Control: no-store, no-cache" ); // IE 8 requires these two lines, exactly like this
header( "Pragma: private" ); // IE 8 requires these two lines, exactly like this
readfile( $tmpfile );
我也有同样的问题。
在设置“内容配置”和“内容类型”后,添加此代码
Java代码
// IE requires these three lines, exactly like this
response.setHeader("CookiesConfigureNoCache", "false");
response.setHeader("Pragma","private,no-cache");
response.setHeader("Cache-control","private,no-store,no-cache,max-age=0,must-revalidate");
PHP代码
// IE requires these three lines, exactly like this
header("CookiesConfigureNoCache: false");
header("Pragma: private,no-cache");
header("Cache-control: private,no-store,no-cache,max-age=0,must-revalidate");
但是可以在普通http上工作吗?我现在不确定,在非ssl模式下应用程序有问题。这篇文章帮了我很多忙。感谢所有做出贡献的人!还是不走运。我在响应标题中尝试了各种组合。它在以前版本的应用程序中工作正常。唯一的区别是响应中存在2个Set Cookie项以及“缓存控制:无缓存=Set Cookie”。这个no-cache=set-cookie值会导致问题吗?我不确定“cache-Control:no-cache=set-cookie”。但是看看(标题为:cookies也会被存储在缓存中吗?)我认为这不会引起任何问题。这可能与IE中的自定义安全设置有关吗?您是否在有额外限制的公司网络上运行IE(可能尝试firefox)?是的,它在公司网络上运行,但在firefox、Chrome和IE9中运行良好。此外,它在网络上的多个用户上运行,因此不会是我们自己定制的IE设置。@Thomas Buckley有趣的是,您在代理服务器后面运行吗?Brian,谢谢你的来信。我更改了我的文件下载逻辑以匹配您的,现在它适用于出现问题的IE8客户端。我不确定到底是哪一行代码造成了不同,但无论如何,谢谢!在所有cookie处理完成后设置“缓存控制”头是什么意思?我怎么知道所有的cookie处理都结束了?我可以在servlet中执行吗?@webdev-是的,在servlet级别。很抱歉,我不知道如何知道cookie处理已经结束?
// IE requires these three lines, exactly like this
response.setHeader("CookiesConfigureNoCache", "false");
response.setHeader("Pragma","private,no-cache");
response.setHeader("Cache-control","private,no-store,no-cache,max-age=0,must-revalidate");
// IE requires these three lines, exactly like this
header("CookiesConfigureNoCache: false");
header("Pragma: private,no-cache");
header("Cache-control: private,no-store,no-cache,max-age=0,must-revalidate");