views:

1149

answers:

0

I'm using a webbrowser control in a C# application. Everything works great until there is an automatic redirect on a website. When this happens, any call to webbrowser.DocumentText gives me this error:

System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
   at System.Windows.Forms.UnsafeNativeMethods.IPersistStreamInit.Save(IStream pstm, Boolean fClearDirty)
   at System.Windows.Forms.WebBrowser.get_DocumentStream()
   at System.Windows.Forms.WebBrowser.get_DocumentText()

This is weird because the page is fully loaded and webbrowser.DocumentTitle works fine. If i refresh the page, the DocumentText works fine like it should. However, i don't want to resort to this. Also, webbrowser.Focus() is having no effect.

Any ideas?