I'm trying to Download a File from the Internet with C# by using the DownloadDataAsync Method of an WebClient Object.
I also want to get the downloading progress by using the DownloadProgressChanged event of the webclient object.
The problem is, neither the BytesReceived nor the TotalBytesToReceive properties are showing up correct values. They are both changing in an irreproducible way when I try to check them while debugging.
My code:
WebClient client = new WebClient();
client.BaseAddress = this.DownloadUrl;
client.DownloadProgressChanged += downloadProgressDelegate;
client.DownloadDataAsync(new System.Uri(this.DownloadUrl));