ailon's DevBlog: Development related stuff in my life

Internet Explorer, HTTPS/SSL and ASPX pretending to be XLS

2/22/2008 5:51:24 PM

I've developed a system for a client where among other things he was able to export a certain product list as CSV file to import it into Excel/OpenOffice etc. I did it the usual way: created an ASPX page which was outputting data in CSV and pretending to be XLS with code like this:

Response.ContentType = "application/";
Response.AddHeader("Content-Disposition", "filename=\"catalog.xls\"");

It all worked fine but then we ran into the Opera's dumb-caching issue, so I added

<%@ OutputCache Location="None" %>

to all sensitive pages. "Excel" export still worked fine. Then we moved the app under https and suddenly export stopped working in IE with the message box claiming

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

In Firefox and Opera it still worked fine.

I found this article in Microsoft's KB explaining that caching should be allowed in order for IE to save the file to temporary folder and then open it from there (hence the file not found error). This solved the problem. Hope this helps someone or myself in the future.

kick it on

Tags: , ,

blog comments powered by Disqus
Copyright © 2003 - 2018 Alan Mendelevich
Powered by BlogEngine.NET