2012-03-20 122 views
0

下面的代碼保存返回401:401與Web客戶端HTTPS

 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)); 

在最後一行。密碼和網址是正確的。任何想法我做錯了什麼?

+1

那麼,無論是憑證是不是正確的,或者你正在談論一個_very_脾氣暴躁的服務器。 – cdeszaq 2012-03-20 13:45:24

+0

嗯,這不是憑證。 – dotnetdev 2012-03-22 15:14:01

回答

0

您是否嘗試添加代理和域名?

WebClient client = new WebClient(); 
client.Proxy = new WebProxy("<<your proxy here>>"); 
client.Proxy.Credentials = new NetworkCredential("login", "password", "domain");