I get an exception when I try to download file using webClient.DowloadFile.
WebClient webClient = new WebClient();
Uri downloadUri = new Uri("http://ia.mediaimdb.com/images/M/MV5BMjA5MTE1MjQyNV5BMl5BanBnXkFtZTcwODI4NDMwNw@@._V1._SY0.jpg");
string posterFilePath =
"D:\Visual Studio Projects\Projects\TFS Source Control\" +
"MyMovieManager\MyMoviesManager\MyMoviesManager\bin\Debug\" +
"MoviesDB\Journey.2.The.Mysterious.Island.2012.DVDRip.XviD-DEPRiVED[ExtraTorrent]\" +
"Journey.2.The.Mysterious.Island.2012.DVDRip.XviD-DEPRiVED[ExtraTorrent].png";
webClient.DownloadFile(downloadUri, posterFilePath);
I found other cases that this exception was thrown and my solution was to use functions from kernel32 and write other functions that will replace the File and Path functions.
Is there something that I can do about DownloadFile function?
you can use webclient.DownloadFile to a temp file, i.e. C:\Temp\myDownload.png , then move it to the path you want. you will need to check whether the c:\Temp folder exists. if not, create it.