?
Solved

ASP.NET-created Excel files don't work properly in IE 8

Posted on 2009-05-18
7
Medium Priority
?
1,920 Views
Last Modified: 2013-12-08
Hi,

I have an ASP.NET web application that allows users to download reports and the contents of databases as Excel files, using the following construct:

        Dim context As HttpContext = HttpContext.Current
        context.Response.ClearHeaders()
        context.Response.ClearContent()
        context.Response.Clear()
        context.Response.AppendHeader("Content-Encoding", "text/html")
        context.Response.AppendHeader("Content-Type", "application/vnd.ms-excel")
        context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + name + ".xls")

And then the user is prompted to Open or Save the file.

In IE 5, 6, and 7, Firefox 2 and 3, Opera, and every browser I've used recently, this works flawlessly. If you click "Open", the file opens in Microsoft Excel (provided the user has it).

But it doesn't work in IE 8. Once I click "Open", it starts Microsoft Excel, and then Excel says "Excel cannot access 'file[1].xls'. The document may be read-only or encrypted."  If you click "OK", it pops up a second error: 'file[1].xls' cannot be accessed. The file may be corrupted, located on a server that is not responding, or read-only".

If I choose "Save" instead of "Open", the file saves just fine.

If I set IE 8 to "Compatibility Mode" for my page, "Open" works just fine.

Adding the site to the "Trusted Sites" list made no difference.

So, I know this is an IE 8 issue, I just don't know how to solve it. I think it has something to do with how IE 8 saves the temporary files. Not sure.

Any suggestions?
0
Comment
Question by:CMES-IT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 24419394
You does not seem to be alone with this problem
http://www.winvistatips.com/pdf-attachments-not-open-after-ie8-t175086.html

There is no fix or workaround yet.

>context.Response.AppendHeader("Content-Encoding", "text/html")
BTW, xls files are not html!
0
 

Author Comment

by:CMES-IT
ID: 25150837
I'm not sure that it's fair to accept a solution that there is no solution.

I don't care if you give him the points and close the question,  but if someone is looking for a solution to this problem, this is not a good answer.

Someone out there has figured out how to do Excel downloads in IE8. I am sure of it.
0
 
LVL 29

Expert Comment

by:Badotz
ID: 25151216
>>I'm not sure that it's fair to accept a solution that there is no solution.

If that is the only answer, then why is it not acceptable?


You said:

If I set IE 8 to "Compatibility Mode" for my page, "Open" works just fine.

Isn't that the solution?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:CMES-IT
ID: 25152468
No, that's not the solution. I'm not the only one using my page, so my browser settings don't matter.

Now, there is a function for IE 8 where you add a line of code to the page header, and IE 8 forcefully renders the page in IE 7.

But, that still is not a solution. That's a hack.

To admit that there is no solution, or use the hack, is to admit that Microsoft purposefully broke Internet Explorer 8's ability to handle Excel files, and I find that highly unlikely, don't you?

The point of this being - perhaps EE doesn't have the answer. And that's disappointing, but acceptable. However, just because no one here reading this thread has the answer, doesn't mean there is one, and I don't think something should be marked as a solution when it isn't.
0
 
LVL 29

Expert Comment

by:Badotz
ID: 25152610
Highly unlikely that they broke it on purpose? Yes.

Highly unlikely that they broke it? Nope. I've written enough software to understand how that could happen.

If you can determine that there *is* a solution, then post it here. We have access to the same tools as you, but our need for a fix may be not be as great as yours.
0
 
LVL 29

Expert Comment

by:Badotz
ID: 25152619
"may be not be as great as yours"

Sheesh, even Yoda wouldn't say that ;-)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question