HTTP 407 Status: Proxy Authentication Required Error Calling Web Service

I spent two hours on this error "HTTP status 407: proxy authentication required error" when calling a web service, my code is like the following

WebProxy oWebProxy = new System.Net.WebProxy(ProxyServer, ProxyPort);
oWebProxy.Credentials = new NetworkCredential(ProxyUser,ProxyPassword,ProxyDomain);
oserv.Proxy = oWebProxy;
oserv.Credentials = new NetworkCredential(theusername, thepassword);

I confirmed that the proxy address and user-user password are correct, and I could access the web service through IE on the same computer, but when I run the code from VS, the error continues to pop up. I also tried UserDefaultCredentials=true, but no luck.

Any idea?

+5
source share
2 answers

<defaultProxy /> app.config/web.config <system.net> useDefaultCredentials="true" .

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.net>
    <defaultProxy useDefaultCredentials="true" />
  </system.net>
</configuration>
+6

, -

-2

All Articles