Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dim downZip As WebClient = New WebClient()<br />
<br />
downZip.DownloadFile(sourceUrl,destinationFile)


While running this code i am getting the following error.

remote server returned an error 403 forbidden...
How can we solve this error? Plz help me friends...
Posted
Updated 7-Nov-10 22:13pm
v2
Comments
PSK_ 8-Nov-10 4:18am    
If you are running your request behind a proxy in that case you need to supply the credentials to the request.

1 solution

Perhaps you have to use NetworkCredentials...

WebClient wc = new WebClient();
NetworkCredential nc = new NetworkCredential("alex", "mypassword");
wc.Credentials = nc;
byte[] response = wc.DownloadData("http://www.java2s.com/index.htm");
 
Share this answer
 
v2
Comments
Hiren solanki 8-Nov-10 5:28am    
Improved for code visibility.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900