我想从网站下载某个文件。为此,我尝试使用这个
WebProxy p = new WebProxy("192.168.10.254:8080", true);
p.Credentials = new NetworkCredential("username", "pwd");
WebRequest.DefaultWebProxy = p;
WebClient client = new WebClient();
string downloadString = client.DownloadString("myDowloadUrl");
每次,我都会收到此网络异常
远程服务器返回错误:(401) Unauthorized。
有什么线索吗?