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/vnd.ms-excel";
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 DotNetKicks.com
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Related posts

Comments

3/13/2008 12:57:59 PM

Eduardo

You can try also with:

Tools -> Internet Options -> Advanced (tab), checkbox “[x] Do not save encrypted pages to disk” prevented IE from saving the exported file to its browser cache (and consequently from opening it afterwards).

Regards,
Edu.

Eduardo es

3/13/2008 6:01:02 PM

ailon

Yes, but I can't try this because I can't control settings on user's computer Smile

ailon lt

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

10/13/2008 11:09:32 AM

Copyright © 2003 - 2008 Alan Mendelevich
Powered by BlogEngine.NET 1.3.1.0