MSHTML Without the WebBrowser control

G

Guest

I have an application that runs as a service. It needs to parse a websites
dom using mshtml. The problem is, to get the document I'm trying to use the
WebBrowser control. That barfs though and says that the control can't run
unless the application is setup as STA. I've marked the thread that runs it
as STA, which allows it to run, but the WebBrowser control doesn't actually
navigate.

Is there any other way to load a document into MSHTML without the WebBrowser
Control?
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi Joshua,

I remember I managed to interop into MSHTML to have it parse HTML, but it
still uses the WebBrowser behind the scenes. The biggest trouble is once an
HTML document to be parsed contains script, this script is executed (leading
either to script error pop-ups, or to message boxes if the script uses the
alert() function).

I'd suggest that you use a third-party parser for your scenario.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top