Click here to Skip to main content
11,924,487 members (54,217 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# Forms VS2012
Hi everyone!

I am running into an issue with using the WebClient.DownloadFile command. It works with small files, but when I try to use it to download ~300MB file, it doesn't download the entire file.

Here is what I have so far:
WebClient webClient = new WebClient();
                webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
                webClient.DownloadFileAsync(new Uri(@"https://mysite/waveform_db.sdf"), @"c:\db.sdf");
Is there a way I can make sure it downloads the entire file?
Posted 16-Nov-12 10:31am
Edited 16-Nov-12 11:49am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This API is very much simplified. For bigger files, the ability to continue downloading after connection was lost or application terminated and other advanced cases, use System.Net.HttpWebRequest:[^].

You can download the source code of my ready-to-use application HTTPDownloader with that implements that "continue downloading" feature and see how it works:
how to download a file from internet[^].

See also my past answers:
FTP: Download Files[^],
how to download a file from the server in 2.0[^].

Espen Harlinn 17-Nov-12 8:59am
Good points :-D
Sergey Alexandrovich Kryukov 17-Nov-12 21:17pm
Thank you, Espen.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151125.3 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100