How to create and download an XML without storing it on the server
Posted
by
CiccioMiami
on Stack Overflow
See other posts from Stack Overflow
or by CiccioMiami
Published on 2012-08-28T15:37:24Z
Indexed on
2012/08/28
15:38 UTC
Read the original article
Hit count: 261
NET Web Forms** application. I would like to create a download link to make available to the user the possibility to download an XML file. However the file does not have to be stored on the server.
In my aspx file I have the download link (placed inside a GridView):
<asp:HyperLinField Text="Download" DataNavigateUrlFormatString="download.aspx?ProductId={0}" DataNavigateUrlFields="ProductId">
In the download.aspx.vb page:
Dim productId As String = Request.QueryString("productId")
Dim xmlDoc As String = _ProductServices.GetXmlDocPerId(productId)
Dim xdoc As XmlDocument = New XmlDocument()
xdoc.LoadXml(xmlLicense)
Now I would like to create a file, place the XML content inside and deliver it to the user without saving it to the server. Shall I use a MemoryStream
combined with a StreamReader
?
© Stack Overflow or respective owner