HTTP status 407: Proxy Authentication Required

By pass Proxy when invoking a web service

<configuration>
<
system.net>
<
defaultProxy useDefaultCredentials=true enabled = “False”> Set enabled as False to bypass proxy
<proxy usesystemdefault= False proxyaddress=http://a.com bypassonlocal=True />
</defaultProxy>
</
system.net>
</configuration>

To specify proxy credentials in your code

NetworkCredential credential = new NetworkCredential(“user”, “password”,“domain”);

Service1 _service = new Service1();

_service.PreAuthenticate = true;

_service.Credentials = credential;

_service.Proxy = WebProxy.GetDefaultProxy();

_service.Proxy.Credentials = CredentialCache.DefaultCredentials;

[more details]

Posted in C#. 4 Comments »