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.