Google Answers Logo
View Question
 
Q: IE pops up two download dialog boxes for opening an excel file ( No Answer,   4 Comments )
Question  
Subject: IE pops up two download dialog boxes for opening an excel file
Category: Computers > Programming
Asked by: ashnildixit-ga
List Price: $20.00
Posted: 29 Jul 2004 14:17 PDT
Expires: 28 Aug 2004 14:17 PDT
Question ID: 380959
I am developing an ASP.NET web application. 

When the user clicks a link button in this application, the
application accesses an excel file and puts it in the http response.
Note that this file is not in the same folder as the application -
that is it is not directly accessible using a URL - you need to click
on the button to access the file. This is by design.

The question is this: when the user clicks the link he must click Open
on two download dialog boxes before the spreadsheet opens. How can I
setup the HttpResponse so that the user has to click once to open the
file? The file must not open in the browser window - but in an excel
window. I know how to do this on my local machine. What I need is a
way to avoid having to do this on all the user's machines locally.

Thanks
Answer  
There is no answer at this time.

Comments  
Subject: Re: IE pops up two download dialog boxes for opening an excel file
From: timmerk15-ga on 29 Jul 2004 17:01 PDT
 
Here's the code anyways - I'll leave it up to you if you want to pay or not:

<%
Response.buffer = TRUE
Response.ContentType = "application/x-msexcel"
Response.AddHeader = 'Content-Disposition: attachment; filename="excel_file.xls"')

Dim vntStream

Set oMyObject = Server.CreateObject("MyObject.BinRead")
vntStream = oMyObject.readBinFile("c:\temp\tempxls.xls")

Response.BinaryWrite(vntStream)

Set oMyObject = Nothing

Response.End
%>
Subject: Re: IE pops up two download dialog boxes for opening an excel file
From: timmerk15-ga on 29 Jul 2004 17:02 PDT
 
Opps, take out that ")" on this line:

Response.AddHeader = 'Content-Disposition: attachment; filename="excel_file.xls"')
Subject: Re: IE pops up two download dialog boxes for opening an excel file
From: ashnildixit-ga on 01 Aug 2004 21:42 PDT
 
Tried that already. Currently my code looks like 

Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("content-disposition", "attachment;filename=\"" +
filename + "\"");
Response.AppendHeader("Content-Length", fi.Length.ToString());
Response.WriteFile(fullpath);
Response.Flush();
Response.Close();

I have also tried 
Response.ContentType = "application/xls";
Response.ContentType = "application/x-msexcel";

all to no avail. the user is still prompted twice.
Subject: Re: IE pops up two download dialog boxes for opening an excel file
From: polarys-ga on 16 Sep 2004 17:06 PDT
 
Make sure you're doing all of the following:
- use a GET request
- make sure the GET request ends with .xls
- use the "Content-Disposition" header in the response

I ran into this problem, myself.  When I changed the form's method
from a POST into a GET, the double dialog boxes disappeared.  See the
following Microsoft KB article for more information on this:

http://support.microsoft.com/default.aspx?scid=kb;en-us;238588

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy