locked
Download File from external link using handler RRS feed

  • Question

  • User-1598965247 posted

    I need to downlaod a file from an external link in my application.

    Ex: http://www.example.com/setup.exe

    Once i redirect to handler, it should allow user to downlod the setup file from above url and the important is the user must not be able to see the above URL while downloading

    Friday, March 20, 2015 8:31 AM

Answers

All replies

  • User-1598965247 posted

    Using the link suggested by you, I can download the files from directory. But my need  is to download from the url i mentioned above  and also the link should not be visible for user while downloading

    Friday, March 20, 2015 9:08 AM
  • User724169276 posted

    Then simple use WebClient in codebehind , this way url is hidden.

    using (WebClient Client = new WebClient())
    {
        Client.DownloadFile("http://www.abc.com/file/song/a.mpeg", "a.mpeg");
    }

    Friday, March 20, 2015 9:16 AM
  • User-1598965247 posted

    Ashim Chatterjee


    using (WebClient Client = new WebClient())
    {
        Client.DownloadFile("http://www.abc.com/file/song/a.mpeg", "a.mpeg");
    }
    Above solution suggested by you can be used to save the file to a drive by giving a path.  The file gets saved from code behind. But i need to download the file from browser
    Friday, March 20, 2015 1:55 PM
  • User724169276 posted

    unclear , please elaborate.

    Saturday, March 21, 2015 12:21 AM
  • User-1818759697 posted

    Hi,

    For this situation, you could refer to the following information about Downloading Files in Asp.net through http handler:

    https://rashimuddin.wordpress.com/2013/06/04/download-files-in-asp-net/

    Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 23, 2015 2:39 AM