473,398 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Streaming Excel Content

I am trying to stream html content as excel data from a
webserver to an IE browser with the following ASP.NET code

First Scenario:
-----------------
An aspx page with a server side button control.
When button is clicked, form is posted and the following code is executed on the server side.

response.Buffer =true;
response.Charset = "";
response.ContentType = "application/vnd.ms-excel";
response.AppendHeader("Content-Disposition", "attachment;filename=sample.xls");
response.Write(data);

IE shows two Open/Save Dialog boxes. It is pretty weird for
the dialog to be prompted two times to download a single
file. I am not sure whether this is problem in IE or I
have to do any anything on the HTTP headers side..
I am using IE 6.0 with SP1.

Second Scenario:
--------------------
Another aspx page which has the same above listed code in the Page_Load event. When this page is requested , IE throws up only one
dialog box to download the file.

I am not sure why IE behaves differently under the above stated scenarios. I like IE to prompt only once. Any help to solve this problem will be appreciated.

Thanks
Krishna

Nov 18 '05 #1
4 1543
Hi, Krishna,

In the first case it looks like the code in the method that handles the
click event of the button is executed twice.

The most probable reson for this is that this handler is attached to the
event twice - once in the auto-generated code by the VS, and once again
automatically because the attribute AutoEventWireUp is set to true (this is
the default value) in the Page directive. Try adding AutoEventWireUp="False"
in the Page directive.

Hope this helps
Martin
"Krishna" <an*******@discussions.microsoft.com> wrote in message
news:91**********************************@microsof t.com...
I am trying to stream html content as excel data from a
webserver to an IE browser with the following ASP.NET code

First Scenario:
-----------------
An aspx page with a server side button control.
When button is clicked, form is posted and the following code is executed on the server side.
response.Buffer =true;
response.Charset = "";
response.ContentType = "application/vnd.ms-excel";
response.AppendHeader("Content-Disposition", "attachment;filename=sample.xls"); response.Write(data);

IE shows two Open/Save Dialog boxes. It is pretty weird for
the dialog to be prompted two times to download a single
file. I am not sure whether this is problem in IE or I
have to do any anything on the HTTP headers side..
I am using IE 6.0 with SP1.

Second Scenario:
--------------------
Another aspx page which has the same above listed code in the Page_Load event. When this page is requested , IE throws up only one dialog box to download the file.

I am not sure why IE behaves differently under the above stated scenarios. I like IE to prompt only once. Any help to solve this problem will be
appreciated.
Thanks
Krishna

Nov 18 '05 #2
Hi Martin
Thanks for looking into the problem
AutoEventWireUp="False" is already set in my page. So, I think the code is getting executed only once. I am not sure whether this is anything to do with ASP.NET sending different HTTP headers for the two cases

Thank
Krishn

Nov 18 '05 #3
I just ran into the same problem today.
Did not try to debug it yet though.
I have 2 different methods to download Excel data and it only did this on
the new one.
The other was fine. Same thing for text files or XML files or .mdb files.
Just the new method got the double prompt.
I thought it was just my PC. Maybe it needed a re-boot.

Any progress??
--
Joe Fallon

"Krishna" <an*******@discussions.microsoft.com> wrote in message
news:D3**********************************@microsof t.com...
Hi Martin,
Thanks for looking into the problem.
AutoEventWireUp="False" is already set in my page. So, I think the code is getting executed only once. I am not sure whether this is anything
to do with ASP.NET sending different HTTP headers for the two cases.
Thanks
Krishna

Nov 18 '05 #4
Hi Joe
I havent done any progress in this issue other than finding out that this happens only when form method is "POST". I am yet to find out what is the difference in HTTP headers,if any, seen by IE browser for it to prompt twice
What is the significance difference between your old method and new method?..

Thank
Krishna
Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: jim | last post by:
I'm trying to stream a html page to the user as an excel file. I'm currently using Response.ContentType = "application/vnd.ms-excel" Response.AddHeader "Content-Disposition", "inline;...
1
by: CJM | last post by:
I have a page which allows the user to open one of several spreadsheets by streaming the XLS to the client. On my development site, everything appears to work fine. On the live site, it works...
6
by: CJM | last post by:
I have a page which allows the user to open one of several spreadsheets by streaming the XLS to the client. On my development site, everything appears to work fine. On the live site, it works...
0
by: Yelena Kaplun | last post by:
Hi, I'm trying to customize print settings while streaming HTML content into Excel. I'm using ASP.NET 1.1 and Excel 2003. While some printer settings like Margins are working correctly, I cannot...
3
by: Casper Hornstrup | last post by:
I have an ASP.NET application that imports product descriptions from an Excel file. The Excel file is uploaded, then a background thread will start importing the product descriptions from the Excel...
2
by: Raja | last post by:
Hi, I want to render my response(ASP.NET) as excel format. So I am using Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("Content-Disposition", "filename=results.xls"); ...
3
by: David Reynolds | last post by:
Does anyone know how I could stream Excel to the browser for download without saving the file somewhere first. I wasn't sure how I would go about it.
0
by: MS News | last post by:
Hi All, I have a requirement to export asp.net page to Excel and Word. I need to set the default page setup for these documents to Landscape and Fit to page. I followed guidelines from the MS KB...
3
by: A.M-SG | last post by:
Hi, I have a ASP.NET aspx file that needs to pass large images from a network storage to client browser. The requirement is that users cannot have access to the network share. The aspx file...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.