how to downloas xml file

Discussion in 'ASP .Net' started by Emmanuel Kahn, Jul 17, 2003.

  1. 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




    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Emmanuel Kahn, Jul 17, 2003
    #1
    1. Advertising

  2. 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



    "Emmanuel Kahn" <> wrote in message
    news:%...
    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




    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Ken Cox [Microsoft MVP], Jul 18, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Leona
    Replies:
    9
    Views:
    2,004
    Henry S. Thompson
    Nov 1, 2004
  2. Robert S

    UPnP xml file to WSDL xml file

    Robert S, Oct 14, 2005, in forum: XML
    Replies:
    1
    Views:
    935
    Robert S
    Oct 14, 2005
  3. jkflens
    Replies:
    2
    Views:
    1,500
    jkflens
    May 30, 2006
  4. Johan
    Replies:
    20
    Views:
    1,613
    Arndt Jonasson
    Feb 27, 2007
  5. Erik Wasser
    Replies:
    5
    Views:
    469
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page