Download function for large in memory file?

  • Thread starter Thread starter Adam Smith
  • Start date Start date
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
 
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();
}

}
 
Back
Top