title: .NET webbrowser control - Automate entry into pop up login form
body: <p>Hopefully this won't be too painful...</p>
  
  <p>I am trying to access a website from a webbrowser control, I have tried two methods (well actually, lots more from googling with mixed results) that have the following problems: </p>
  
  <pre><code> URL = "http://username:password@thewebsite.com"
   WebBrowser1.Navigate(URL)
  </code></pre>
  
  <p>1: This method results in a window security pop up, asking me to log in to the company proxy. I guess this is because I am using the username/password for the website and the URL navigation is attempting to input it to the proxy?</p>
  
  <p>If I attempt to automate/avoid the proxy bit by doing this:</p>
  
  <pre><code>Dim Headers As String = "Proxy-Authorization: Basic " &amp; Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes("USERNAME:PASSWORD"))
  WebBrowser1.Navigate(URL, "", Encoding.Unicode.GetBytes(String.Empty), Headers)
  </code></pre>
  
  <p>I still meet with failure as the proxy log in box pops up regardless.</p>
  
  <p>2:
  If I go straight to the website without editing the URL:</p>
  
  <pre><code> URL = "http://thewebsite.com"
   WebBrowser1.Navigate(URL)
  </code></pre>
  
  <p>Then it takes me to teh website without any proxy messages at all (great!) but the website then pops up a log in box that I need to populate.  Sadly I cannot get hold of any elementids for this (to automate) as it is a windows form pop up outside of the webbrowser control, and I cannot seem to interrogate it or figure out how to input into it.</p>
  
  <p>Does anyone have any ideas for what I should try next? Is there some way to get the login form from method 2 to either populate itself or at least let me view the source of that page?  I cannot click away from it until it is populated correctly.</p>
  
  <p>I just cannot seem to get anything to work that will deal with both log in forms for me, it is either one or the other. (both forms look like windows standard log in prompts, they are not built into the webpage).
  Thanks</p>