title: C# System.InvalidCastException
body: <p>Why I'm getting this error?</p>
  
  <p><img src="https://i.stack.imgur.com/D4o4Q.jpg" alt="enter image description here"></p>
  
  <pre><code>System.InvalidCastException was unhandled by user code
    Message=Specified cast is not valid.
    Source=System.Windows.Forms
    StackTrace:
         at System.Windows.Forms.UnsafeNativeMethods.IHTMLDocument2.GetLocation()
         at System.Windows.Forms.WebBrowser.get_Document()
         at System.Windows.Forms.WebBrowser.get_DocumentStream()
         at System.Windows.Forms.WebBrowser.get_DocumentText()
         at SiteBot.MainWindow.backgroundWorker1_DoWork(Object sender, DoWorkEventArgs e) in D:\Documents\Visual Studio 2010\Projects\SiteBot\MainWindow.cs:line 35
         at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
         at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
    InnerException: 
  </code></pre>