473,473 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Saving Downloaded Xml from ASPX page as File

I've got an ASPX page that simply builds an Xml document and does a
Response.Write back to the client with that Xml, something like this:

// Get the content as the Xml contained within the current working model
string content = someDataSet.GetXml();

// Write the response back to the user's stream
this.Response.Clear();
this.Response.ContentType = "text/xml";
this.Response.Write(content);
this.Response.End();
Right now, this causes IE to just display the data in it's typical Xml
incarnation - it's default behavior. My intention is that the user will
recieve the Save As... dialog box and can save this Xml to a file on their
machine instead of actually having to view it and manually use the browsers
Save As... menu item from the File menu. Part of the problem is that this
Xml file is produced via a local Intranet and is fairly large (say 10 MB).
When IE tries to actually parse and display the Xml, it takes forever.

I'm wondering if there is some other ContentType value that might cause the
trigger the Save As dialog immediately...?

Any ideas would be greatly appreciated.

Thanks,
Chris

Nov 18 '05 #1
1 1376
Got it! After further investigation, I stumbled across the
Content-Disposition header that you can set to force the Save As dialog box.
Worked like a charm.

Chris

"Christopher D. Wiederspan" <wi********@reachdigital.com> wrote in message
news:u0**************@TK2MSFTNGP14.phx.gbl...
I've got an ASPX page that simply builds an Xml document and does a
Response.Write back to the client with that Xml, something like this:

// Get the content as the Xml contained within the current working model
string content = someDataSet.GetXml();

// Write the response back to the user's stream
this.Response.Clear();
this.Response.ContentType = "text/xml";
this.Response.Write(content);
this.Response.End();
Right now, this causes IE to just display the data in it's typical Xml
incarnation - it's default behavior. My intention is that the user will
recieve the Save As... dialog box and can save this Xml to a file on their
machine instead of actually having to view it and manually use the browsers Save As... menu item from the File menu. Part of the problem is that this
Xml file is produced via a local Intranet and is fairly large (say 10 MB).
When IE tries to actually parse and display the Xml, it takes forever.

I'm wondering if there is some other ContentType value that might cause the trigger the Save As dialog immediately...?

Any ideas would be greatly appreciated.

Thanks,
Chris

Nov 18 '05 #2

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

Similar topics

1
by: rohith | last post by:
Hope someone can help with this question. I have a digital camera that will be used to capture photographs for picture ids. My question is whether I can capture the image from a web page...
7
by: Marc Pelletier | last post by:
Hello all, I have a class which includes a method to create a chart. I want to be able to call this method from asp.net code as well as windows application code, so I have sketched it out as...
3
by: Clay Black | last post by:
I need to find a way to save an HTML page to the IIS server. What I need is to have a button that once it is clicked the current page being displayed is saved to a location on the local IIS...
1
by: M. D'Costa | last post by:
Hello, I am saving a csv file through an ASP.NET web application. The data is obtained from a database and saved to the local users machine. I am using the Response objects methods of...
2
by: M. D'Costa | last post by:
Hello, I am saving a csv file through an ASP.NET web application. The data is obtained from a database and saved to the local users machine. I am using the Response objects methods of...
2
by: M. D'Costa | last post by:
Hello, I have an ASP.NET application that allows a user to save a csv file with certain data they requested. The problem is as follows: On my machine it works fine and prompts me to save the...
16
by: Fred | last post by:
hi, is there some way to prevent(at least for not so advanced users) image saving on local disk; currently i use javascript which handles the right mouse button click, but all it takes is to...
1
by: Brett Kelly | last post by:
Ok, I know this sounds odd. Let me explain further. I have an ASP.net page (w/ C# code behind) that, when given a session variable containing the path to a local file, will attempt to start the...
6
by: Jeff | last post by:
Hey (and thank you for reading my post) In visual web developer 2005 express edition I've created a simple website project.. At this website I want users who register to be able to upload a...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
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,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.