2012-09-24 69 views
1

我的頁面上有一個WebBrowser控件。在瀏覽器控件中顯示的頁面上觸發一些JavaScript。當我嘗試保存我的網頁我得到這個錯誤webbrowser.document引發指定的轉換不是有效的異常

String strHtml = _browser.Document.Body.OuterText; 
File.WriteAllText("C:\saveme.html", strHtml); 

這行_browser.Document.Body.OuterText拋出異常

Exception:: Specified cast is not valid. 
at System.Windows.Forms.UnsafeNativeMethods.IHTMLDocument2.GetLocation() 
at System.Windows.Forms.WebBrowser.get_Document().... 

我原來也用過調用,但開不工作, 有沒有我錯過的任何東西

回答

相關問題