Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# Forms VisualStudio2012 , +
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 at 17-Nov-12 8:59am
Good points :-D
Sergey Alexandrovich Kryukov at 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
0 Sergey Alexandrovich Kryukov 9,578
1 OriginalGriff 8,420
2 Peter Leow 4,874
3 Kornfeld Eliyahu Peter 3,240
4 Maciej Los 2,356

Advertise | Privacy | Mobile
Web03 | 2.8.150327.1 | 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