473,796 Members | 2,742 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Charse t = "";
response.Conten tType = "applicatio n/vnd.ms-excel";
response.Append Header("Content-Disposition", "attachment;fil ename=sample.xl s");
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 1559
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*******@disc ussions.microso ft.com> wrote in message
news:91******** *************** ***********@mic rosoft.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.Charse t = "";
response.Conten tType = "applicatio n/vnd.ms-excel";
response.Append Header("Content-Disposition", "attachment;fil ename=sample.xl s"); 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*******@disc ussions.microso ft.com> wrote in message
news:D3******** *************** ***********@mic rosoft.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
12671
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; filename=download.xls " The actual streaming and excel file are working fine but in excel its not picking up the filename its actually showing up as the url to the page that downloads this. I
1
422
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 fine for the vast majority of users, but not for my colleague & I. When this page is called with the correct inputs, the standard Open/Save/Cancel/More Info dialog should appear. In the dialog, it gives the following details:
6
3624
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 fine for the vast majority of users, but not for my colleague & I. When this page is called with the correct inputs, the standard Open/Save/Cancel/More Info dialog should appear. In the dialog, it gives the following details:
0
2036
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 change the Page Orientation to Landscape: mso-page-orientation:landscape;. I tried to produce the Excel Page, save it as HTML, open in text editor and then copy and paste Excel generated settings. But it did not help. If anybody resolved this...
3
1461
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 file. When the Excel file is uploaded, the user's browser is redirected (using Response.Redirect) to a new page that will stream some javascript to show the progress of the import. I do perform a Response.Flush() after each script tag. I've...
2
1112
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"); But I have more than 10,000. Is there any way that I can improve the response by streaming (uisng MemoryStream or any other Stream class) ? Thanks,
3
18927
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
1187
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 article "How To Format an Excel Workbook While Streaming MIME Content"(http://support.microsoft.com/kb/271572/EN-US/) to be able to successfully set Landscape orientation in Excel,how ever the "Fit To Page" xml directive is not working. Also I...
3
2344
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 must be the only method that users receive image files.
0
10244
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10201
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5454
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4130
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.