title: 407 Authentication required - no challenge sent
body: <p><strong>Update:</strong><br />
  If you've just arrived at this question, the general gist is that I'm trying to make a HttpWebRequest via a proxy, and I'm getting a 407 from our strange proxy server. IE,Firefox,Chrome all manage to negotiate the proxy sucessfully, as do Adobe Air applications. It may be important that the Google Chrome web installer actually fails and we have to use an offline installer.</p>
  <p>Thanks to Ian's link I've got it getting through to the next stage. It is now sending a token back to the proxy, however the 3rd stage isn't getting through, so the request with the username/password hash isn't being sent by .NET and consequently no HTML is returned.</p>
  <p>I am using:</p>
  <ul>
  <li>IE6 user-agent</li>
  <li>Windows 7</li>
  <li>Scansafe proxy</li>
  <li>.NET 3.5</li>
  </ul>
  <p>Here's the latest code that equates to the logs below:</p>
  <pre><code>HttpWebRequest request = HttpWebRequest.Create(&quot;http://www.yahoo.com&quot;) as HttpWebRequest;
  IWebProxy proxy = request.Proxy;
  // Print the Proxy Url to the console.
  if (proxy != null)
  {
      // Use the default credentials of the logged on user.
      proxy.Credentials = CredentialCache.DefaultCredentials;
  }
  request.UserAgent = &quot;Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)&quot;;
  request.Accept = &quot;*/*&quot;;
  
  HttpWebResponse response = request.GetResponse() as HttpWebResponse;
  Stream stream = response.GetResponseStream();
  </code></pre>
  <p>The exception</p>
  <blockquote>
  <p>WebException (407) Authentication Required.</p>
  </blockquote>
  <h2>The proxy being used</h2>
  <p>The proxy client is a <a href="http://www.scansafe.com/managed_services/web_filtering" rel="noreferrer">Scansafe</a> hardware device in our server room, which (once authenticated with NTLM) then directs your HTTP traffic to its servers to filter the traffic.</p>
  <h2>System.Net tracing output</h2>
  <ul>
  <li><strong><a href="http://pastebin.com/m52afe453" rel="noreferrer">Here's the trace output</a></strong></li>
  </ul>
  <h2>IE sucessfully negotiating the proxy</h2>
  <ul>
  <li><strong><a href="http://pastebin.com/m7ac60835" rel="noreferrer">Fidder output</a></strong></li>
  </ul>
  <h2>The solution</h2>
  <p>I haven't really found a solution but thanks to Feroze and Eric I have found a workaround and discovered that the actual proxy (and not its configuration) is the main issue. It may be an obscure issue with 3 variables: .NET HttpWebRequest's implementation, Windows 7 and of course the Scansafe hardware client that sits in our rack; but without an MSDN support request I won't find out.</p>