开发者

issue with WebClient DownloadString

开发者 https://www.devze.com 2023-03-02 03:58 出处:网络
issue with WebClient DownloadString : My Code ~ WebClient Wc = new WebClient(); string myUrl = \"http://www.google.com\";

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 w开发者_Python百科orking properly then what can be the issue with this ?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消