I'm trying to download set of files from web and im writing a C# console app. And im using web client to do this. The problem is it wont able to download the file unless i open the file download link in the browser. I don't know the reason why this happens. I was thinking this has something to do with sessions. Any help would be appreciated.
This is my code
private bool DownloadFile(string pdfId, string filetype)
{
try
{
using (WebClient webClient = new WebClient())
{
webClient.DownloadFile("http://ift.tt/1owUhlA", "E:\\New\\File.pdf");
}
return true;
}
catch (Exception ex)
{
Execption = ex.Message;
return false;
}
}
The error im getting is
"The remote server returned an error:(404) not found"
Aucun commentaire:
Enregistrer un commentaire