Download function for large in memory file?

Discussion in 'ASP .Net' started by Adam Smith, Apr 17, 2004.

  1. Adam Smith

    Adam Smith Guest

    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

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Adam Smith, Apr 17, 2004
    #1
    1. Advertising

  2. Adam Smith

    Adam Smith Guest

    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();
    }

    }

    Adam Smith <> wrote in message news:<#>...
    > 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
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    Adam Smith, Apr 21, 2004
    #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. Ryan Taylor
    Replies:
    2
    Views:
    945
    Ryan Taylor
    Nov 10, 2004
  2. Sam --
    Replies:
    2
    Views:
    608
    Sam --
    Mar 17, 2005
  3. =?Utf-8?B?UGV0ZXJU?=
    Replies:
    3
    Views:
    399
    Yuan Ren[MSFT]
    Jan 22, 2006
  4. Brett  Kelly
    Replies:
    1
    Views:
    679
    Steve C. Orr [MVP, MCSD]
    Jun 16, 2006
  5. Replies:
    5
    Views:
    874
    Xho Jingleheimerschmidt
    Apr 2, 2009
Loading...

Share This Page