how to downloas xml file

  • Thread starter Thread starter Emmanuel Kahn
  • Start date Start date
E

Emmanuel Kahn

Hi Sreejumon and thanks

I would like to download xml and the user must select the path of the
downloaded file
the user will select where the file will be saved !!!

two problems:

1)I know that I can create a XML file on my server using writexml method
of the dataset.
To download the file I use simple HREF or asp hyperlink
for .doc file for instance it will automatically open a dialog box
asking the user open/save and where to save this file.
for xml the browser automatically open the file. when I want to save it
only and not to open it.

2) with rendercontrol how can the user select the path ?

thanks

Manu
 
Hi Emmanuel,

The code below gets a dataset and pushes it out as a file for download. Does it
do what you need?

Ken
MVP [ASP.NET]


Imports System.io
Public Class writexmlp
Inherits System.Web.UI.Page


Private Sub Button1_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
Dim ds As New DataSet
ds.ReadXml(Server.MapPath("a.xml"))
Dim xmlstream As New MemoryStream
ds.WriteXml(xmlstream)
Response.AppendHeader _
("Content-disposition", _
"attachment; filename=a.xml")
Response.ContentType = "application/download"
Response.BinaryWrite(xmlstream.ToArray())
Response.End()
End Sub
End Class



Hi Sreejumon and thanks

I would like to download xml and the user must select the path of the
downloaded file
the user will select where the file will be saved !!!

two problems:

1)I know that I can create a XML file on my server using writexml method
of the dataset.
To download the file I use simple HREF or asp hyperlink
for .doc file for instance it will automatically open a dialog box
asking the user open/save and where to save this file.
for xml the browser automatically open the file. when I want to save it
only and not to open it.

2) with rendercontrol how can the user select the path ?

thanks

Manu
 
Back
Top