How to download a image from a protected link

324 views Asked by At

How to download a image from a protected below link http://epaper.manoramaonline.com/MMDaily/Malappuram/2014/05/30/F/MMDaily_Malappuram_2014_05_30_F_FP_001/1228_274_1940_1862.jpg

while I downloading this jpeg file the following error was display " the remote server returned an error (403) forbidden". Please help me to find a solution.

The following code was used..

My.Computer.Network.DownloadFile("http://epaper.manoramaonline.com/MMDaily/Malappuram/2014/05/30/F/MMDaily_Malappuram_2014_05_30_F_FP_001/1228_274_1940_1862.jpg", "D:/ynews.jpg")
1

There are 1 answers

0
Jithil P Ponnan On

You might need to specify the network credential to bypass the authorization and authentication. I can give you an example of C# Code of the same. You check the same with VB.Net and try to resolve.

WebClient webClient = new WebClient();
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(webClient_DownloadFileCompleted);
webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(webClient_DownloadProgressChanged);
webClient.Credentials = new NetworkCredential("user", "pass");
webClient.DownloadFileAsync(new Uri("http://example.com/example.jpg"), @"c:\myfile.txt");