C
CodeRazor
I am converting a windows application which contains a web browser control
into an ASP.net application.
The Windows project references all manner of html controls in the WebBrowser
control and retrieves values using the HtmlControlCollection class etc.
I was hoping I was going to be able to work with the
Windows.Forms.WebBrowser object from inside my ASP.net webform by simply
adding a reference to System.Windows.Forms and doing code like below:
WebBrowser webBrowser = new WebBrowser();
webBrowser.DocumentText = "<html><body>my document</body></html>;
HtmlDocument htmlDocument = webBrowser.Document;
However, it blows up with the following error:
ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be
instantiated because the current thread is not in a single-threaded
apartment.
Is there any way to get round this problem. It would save having to totally
rewrite this project.
Many thank,
CodeRazor
into an ASP.net application.
The Windows project references all manner of html controls in the WebBrowser
control and retrieves values using the HtmlControlCollection class etc.
I was hoping I was going to be able to work with the
Windows.Forms.WebBrowser object from inside my ASP.net webform by simply
adding a reference to System.Windows.Forms and doing code like below:
WebBrowser webBrowser = new WebBrowser();
webBrowser.DocumentText = "<html><body>my document</body></html>;
HtmlDocument htmlDocument = webBrowser.Document;
However, it blows up with the following error:
ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be
instantiated because the current thread is not in a single-threaded
apartment.
Is there any way to get round this problem. It would save having to totally
rewrite this project.
Many thank,
CodeRazor