Using code below but it is not downloading any file at all to the specified subfolder named myImages to the application... How can I fix this? The link is purely an example here, usually the link will be a variable and that has no issue populating itself. This is all being done in a BackgroundWorker that works 100% fine otherwise.
//File to download
string _fileToDownload = "http://www.codeproject.com/images/download24.png"
//Path to download files
string _filePath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "MyImages\\download24.png'";
//Download the image
using (var webClient = new WebClient())
{
webClient.DownloadFileAsync(new Uri(_fileToDownload ), @_filePath);
}
Thanks.
In your case there is no need to use asynchronous file download. This should work:
webClient.DownloadFile(_fileToDownload, _filePath);