【发布时间】:2011-05-03 13:56:40
【问题描述】:
WebClient 下载字符串的问题:
我的代码~
WebClient Wc = new WebClient();
string myUrl = "http://www.google.com";
string myStr = string.Empty;
myStr = Wc.DownloadString(myUrl);
Console.Write(myStr);
错误: 远程服务器返回错误:(401) Unauthorized.
注意:
互联网工作正常,那么这可能是什么问题?
【问题讨论】:
-
即使这似乎也不起作用: NetworkCredential Nc = new NetworkCredential("username","password","domain"); Wc.Credentials = Nc;
标签: c# .net-3.5 download webclient downloadstring