I am trying to create a xls file through java code and allow user to doownload it. The download code is in JSP and it works well in IE9 and other browsers. But it give error in IE 8 as "Unable to dowload file. Unable to open this internet site.The requested site is either unavailable or can not be found.Please try later."
my JSP code is as follows.
<%@ page import="org.apache.poi.ss.usermodel.Workbook"%><%@ page import="java.io.*"%>
<%response.setHeader("Pragma","no-cache");
response.setHeader("Content-disposition", "attachment;filename=DataTemplate.xls");
response.setContentType("application/vnd.ms-excel");
OutputStream os = response.getOutputStream();
((Workbook)request.getAttribute("result")).write(os); os.flush();os.close();%>
I checked all the settings for IE as suggested by microsoft sites. Suggestions from other users on internet are to re-install IE8 but it does not sound good to me as I am getting this issue on multiple machines.
Any help is welcome.
Thanks.
This issue occurs if the server sends a "Cache-control:no-store
" header or
sends a "Cache-control:no-cache
" header.
One of the solution is to add Cache-Control: private
to response header.
Also, There are few official blog on Microsoft Support. Check these links one of them should help you to solve the problem.
http://support.microsoft.com/kb/815313
http://support.microsoft.com/kb/323308
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With