C# 401与网络客户端https
以下代码不断返回401:C# 401与网络客户端https,c#,C#,以下代码不断返回401: String URI = "https://api.opsourcecloud.net/oec/0.9/myaccount"; WebClient webClient = new WebClient(); webClient.Credentials = new NetworkCredential("username", "password"); string s = webClient.Downlo
String URI = "https://api.opsourcecloud.net/oec/0.9/myaccount";
WebClient webClient = new WebClient();
webClient.Credentials = new NetworkCredential("username", "password");
string s = webClient.DownloadString(URI);
StreamReader reader = new StreamReader( webClient.OpenRead(URI));
在最后一行。密码和url是正确的。知道我做错了什么吗?你试过添加代理和域吗
WebClient client = new WebClient();
client.Proxy = new WebProxy("<<your proxy here>>");
client.Proxy.Credentials = new NetworkCredential("login", "password", "domain");
嗯,要么凭证不正确,要么你正在和一个脾气暴躁的服务器交谈。嗯,这不是凭证。