HttpWebRequest WebExcepton: The remote server returned an error: (407) Proxy Authentication Required.

1. Supply the credentials of the Currently Logged on User to the Proxy object similar to this:

// Begin code change by jeff

 
                    //  Obtain the ‘Proxy‘ of the  Default browser. 
                    IWebProxy theProxy = aReq.Proxy;
                    // Print the Proxy Url to the console.
                    if (theProxy != null)
                    {
// Use the default credentials of the logged on user.
                        theProxy.Credentials = CredentialCache.DefaultCredentials;
                    }
                    // End code change by jeff
 
                    HttpWebResponse aResp = aReq.GetResponse() as HttpWebResponse;

  2. Add this property to the <<application>>.exe.config or machine.config file:

<system.net>
    <defaultProxy useDefaultCredentials="true"> </defaultProxy>
</system.net>

  link:http://blogs.msdn.com/b/jpsanders/archive/2009/03/24/httpwebrequest-webexcepton-the-remote-server-returned-an-error-407-proxy-authentication-required.aspx

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。