Tuesday, July 8, 2008

"Internet Explorer Cannot Download" Error Message When You Use HTTPS URL

Internet Explorer will not display attachments when HTTPS is used. This bug has been documented in the link below.

http://support.microsoft.com/kb/812935/

If the development environment is not using HTTPS this issue will be identified only at a later stage when we move on to integration testing environment where we normally use HTTPS.

The following are the steps to be followed for the workaround.

1. In the Servlet code please use the below snippet.
response.reset();
//If the report type is other than PDF handle accordingly]
response.setContentType("application/pdf");
response.setHeader("Content-Disposition","attachment; filename=Report.pdf");
response.setHeader("Pragma", "public");
response.setHeader("Cache-control", "max-age=30");

//The logic to write into the OutputStream goes here.

Note: The reset of HttpServletResponse is very important.

2. Ensure Do not save encrypted pages to disk check box is not selected in Internet Explorer.

3. Incase of IE 7, ensure the automatic prompting for downloads is enabled under Tools-->Internet Options-->Custom Level --> Downloads.

Note: You would have configured HTTPS using the following in web.xml in Tomcat using security-constraint

0 Comments:

Post a Comment

<< Home