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