Download function for large in memory file?

A

Adam Smith

Is there any way, from the user pressing a button to download to them a
string in memory? What I want to do is retrieve a large text block from
the database and send it to them as a file.

Thanks in advance.

Adam Smith
 
A

Adam Smith

Found it!
private void OnItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName == "Download")
{

string sResult =
"<Hello>world</Hello>"l

Response.ContentType = "text/xml";
Response.AddHeader("content-disposition","attachment;
filename=\"ResultDoc.xml\"");
Response.Write(sResultXml);
Response.End();
}

}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top