Solved

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

Posted on 2009-05-18
7
1,916 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 500 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Several part series to implement Internet Explorer 11 Enterprise Mode
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
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 +…

730 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