Pratik
Pratik

Reputation: 11745

issue with WebClient DownloadString

issue with WebClient DownloadString :

My Code ~

WebClient Wc = new WebClient();
string myUrl = "http://www.google.com";
string myStr = string.Empty;
myStr = Wc.DownloadString(myUrl);
Console.Write(myStr);

Error : The remote server returned an error: (401) Unauthorized.

Note :

Internet is working properly then what can be the issue with this ?

Upvotes: 0

Views: 1590

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1503839

I suspect you may need to specify some proxy settings. Use Wireshark to look at the difference between what happens in your test app and what happens in a browser. I expect that both are going to a proxy, but that the browser request has proxy authentication and the WebClient one doesn't.

Upvotes: 1

Related Questions