I've got a WebBrowser control on my page. To fire some javascript on a page displayed in the browser control. and when i try to save my web page i got this error
String strHtml = _browser.Document.Body.OuterText;
File.WriteAllText("C:\saveme.html", strHtml);
and this line _browser.Document.Body.OuterText throws the exception
Exception:: Specified cast is not valid.
at System.Windows.Forms.UnsafeNativeMethods.IHTMLDocument2.GetLocation()
at System.Windows.Forms.WebBrowser.get_Document()....
i had also used Invoke but does't work , is there any thing i missed out