Maturano
Maturano

Reputation: 1023

Saving XML in client machine

I have an option in my VBScript page where the user can click and I simply read a XML from a database and then I want to save this XML in his machine.

What I have so far is:

Dim xml: Set xml = Server.CreateObject("MSXML2.DOMDocument.3.0")     
xml.LoadXml(xmlEnvio)

Where xmlEnvio is a variable that contains a XML in string format.

I tried to figure out how to generate and save this file in the client machine but nothing works so far.

This is the closest solution I've found, but it's using LoadFromFile and I need to generate the file before.

Does anybody knows an approach for doing this?

Upvotes: 0

Views: 297

Answers (1)

Vixed
Vixed

Reputation: 3509

This should work:

<%
xmlEnvio="<primoPiatto>Spaghetti</primoPiatto>" 'USED IN MY TEST

Response.AddHeader "Content-disposition", "attachment; filename=spaghetti.xml"
Response.ContentType = "text/xml"
Response.BinaryWrite(xmlEnvio)
Response.End
%>

Upvotes: 2

Related Questions