码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2014-09-30 14:42:49      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   os   ar   sp   div   c   on   

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.

标签:blog   http   io   os   ar   sp   div   c   on   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!