title: WebBrowser control with an automated proxy login
body: <p>I have a windows form application that contains a <code>WebBrowser</code> control. The idea is for the <code>WebBrowser</code> to surf websites without user interaction. The <code>WebBrowser</code> goes through a proxy to access the internet. </p>
  
  <p>I can see the requests coming through on the proxy, but they are being denied because it fails proxy authentication.</p>
  
  <p>I have added the <code>Proxy-Authorization: Basic</code> header. This works for a normal http page but it does not seem to work https:</p>
  
  <pre><code>var credentialStringValue = "proxyUser:proxyPassword";
  byte[] credentialByteArray = ASCIIEncoding.ASCII.GetBytes(credentialStringValue);
  var credentialBase64String = Convert.ToBase64String(credentialByteArray);
  
  string Headers = string.Format("Proxy-Authorization: Basic {0}{1}", credentialBase64String, Environment.NewLine);
  
  ws.Navigate(url,TargetFrameName,PostData,Headers);
  </code></pre>
  
  <p>Where <code>ws</code> is equal to <code>new WebBrowser()</code>. The credentials are correct, because it works when I do it manually. </p>
  
  <p>Any idea as to how I can programatically Authenticate the proxy credentials?</p>