This event is raised each time an asynchronous download makes progress. This event is raised when downloads are started using any of the following methods.
WebClient.DownloadDataAsync(Uri) |
Downloads data from a resource and returns a byte array, without blocking the calling thread. |
WebClient.DownloadFileAsync(Uri, string) |
Downloads data from a resource to a local file, without blocking the calling thread. |
WebClient.OpenReadAsync(Uri) |
Returns the data from a resource, without blocking the calling thread. |
The System.Net.DownloadProgressChangedEventHandler is the delegate for this event. The System.Net.DownloadProgressChangedEventArgs class provides the event handler with event data.
For more information about handling events, see Consuming Events.
A passive FTP file transfer will always show a progress percentage of zero, since the server did not send the file size. To show progress, you can change the FTP connection to active by overriding the WebClient.GetWebRequest(Uri) virtual method:
Example
internal class MyWebClient:WebClient{ protected override WebRequest GetWebRequest(Uri address) { FtpWebRequest req = (FtpWebRequest)base.GetWebRequest(address); req.UsePassive = false; return req; } }