Tech Off Thread

4 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

HTTP Download

Back to Forum: Tech Off
  • User profile image

    Hi everyone:

    As part of my current project I'm working on using C#.  My assigment involves to download files (some of them quite large) from an HTTP server, I know this is not rocket rocket science specially in .net world.

    So while I can succesfully download  the files, my issue is that no method I've tried including the built in WebClient class can match the speed when I try to download the same file using IE or any other web browser.

    Of course the question is if any of you guys how the browsers download the files and how can I implement such a method in C#?


    Thanx in advance,



    PS: Yes I've googled/binged this to no success so far.

  • User profile image


    using System.Net;

    WebClient wc = new WebClient();
    wc.DownloadFile(httpHostName, localFileName);


    Under the hood this is using the same mechanism to download the files as Internet Explorer (WinInet/WinHttp).

  • User profile image

    And in case WebClient is not enough (rarely the case), you can always resort to HttpWebRequest.

  • User profile image

    also you may need to check on buffer sizes .....    i bet the browser does some tuning that your app does not do.

    for example if the http stream is coming back with 4 meg chunks then the client buffer size should be some multiple of that value so that it does not have to alloc more storage while downloading.

    stuff like that can make a huge difference in perf.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.