首页 > Web开发 > 详细

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

时间:2014-09-30 14:27:19      阅读:608      评论:0      收藏:0      [点我收藏+]

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

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

原文:http://www.cnblogs.com/joe-yang/p/4001780.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!