Page view counter

How can I download a file

Last post 03-11-2009 3:25 AM by anandkbs. 3 replies.

Sort Posts:

  • How can I download a file

    07-05-2007, 2:36 AM

    I want to add a link through where customer can download file.How can i do that.Please help.

  • Re: How can I download a file

    07-05-2007, 3:33 PM
    Answer
    • Loading...
    • haidar_bilal
    • Joined on 07-14-2003, 1:43 AM
    • Lebanon - Beirut
    • Posts 8,726
    • Points 45,563
    Bilal Hadiar, MCP, MCTS, MCPD, MCT
    Microsoft MVP - Telerik MVP
  • Re: How can I download a file

    07-05-2007, 3:38 PM
    • Loading...
    • keyboardcowboy
    • Joined on 06-14-2007, 7:39 PM
    • Thornhill Ontario
    • Posts 1,045
    • Points 5,529

     in the links click event you can do

    Response.Redirect("locationofthefile.filetype");
    
    normally that will link to another page, but when the file type is not a web format, so say something like .mp3, it will prompt for a download
    Please remember to click "Mark as Answer" on this post if it helped you.
  • Re: How can I download a file

    03-11-2009, 3:25 AM
    • Loading...
    • anandkbs
    • Joined on 11-13-2008, 9:36 AM
    • Bangalore
    • Posts 12
    • Points 44

    Just send the full file name of the file that as to be downloaded.

     private void DownloadFile(string FileName)
     {
            Response.AddHeader("Content-Disposition", "attachment;filename=" +              HttpUtility.UrlEncode(FileName));

            Response.ContentType = "application/octet-stream";
            Response.TransmitFile(FileName);
    }  

Page 1 of 1 (4 items)