Here's my code to download the file.
WebClient client=new WebClient()
public void DownloadFile()
{
Uri uri = new Uri(url);
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged);
client.DownloadFileAsync(uri, fileName);
}
Here's my code to cancel the downloading file.
public void CancelDownloadingFile()
{
client.CancelAsync();
client.Dispose();
}
But when i call the CancelDownloadingFile() method it does nothing. The File keeps downloading in the background. Any suggestions is appreciated. Thanks.