11 comments on “Download / Send Request AsyncWithProgress with HttpClient

  1. Well, BackgroundTransfer API also provides progress and token to cancel action.

    UploadOperation.StartAsync().AsTask(CancellationTokenSource .Token, new Progress(OnUploadProgress));


    • hey ray, you are right but you cannot send a, say, POST request with some special heads and a specific type of content (e.g. FormUrlEncodedContent) to download something with the Background Transfer API. You can but you would need prepare the content stream yourself.


  2. Thanks for code and example, but… Why this very needful feature is not implemented in the HttpClient code? .NET 4.5 developers should meet Silverlight dev team much more frequently!
    For me it’s looks like carelessness from the MS side 😦


    • thanks a lot for your comment. In most cases, background transfer API is used, and Microsoft is trying to encourage this api. I think that’s the main reason. This post only deals with very specific cases where you need to prepare a specific request to download a file.


    • hey there, sorry for the late response…you can use the cancellation source to cancel the progress:

      var token = m_CancellationSource.Token;

      var operationWithProgress = client.GetStringAsyncWithProgress(request, token);

      operationWithProgress.Progress = new AsyncOperationProgressHandler((result, progress) => { reportProgress(progress); });



  3. i have problem to download file using Background Transfer Api.
    i want to download file in Windows RT take double time as compare to Ipad/Iphone
    How can improve my download speed in WIndows RT to download as same speed of IPad/ Iphone (we are using same network to download and same Url in windows and iphone/ipad)

    Same in browser for windows and mac it take double time in windows system then mac system.
    I am Searching it from couple of Week.
    Please Help….


  4. Pingback: Async Development in WinRT – II | Can Bilgin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s