Asked By Nicholas Paldino [.NET/C# MVP]
14-Feb-08 04:18 PM
Robert,
This would be difficult in this situation. You couldn't use the
WebBrowser control, because it needs to be tied to a UI thread.
You could use MSHTML through COM interop. However, you would have to
make sure that every thread that you use MSHTML on is set up so that the
ApartmentState for that thread is STA. I am not sure about this, but I also
believe you would have to pump messages in order for the events to work
correctly.
Needless to say, it's a better idea in this case to use
HttpWebRequest/HttpWebResponse and then take the content from those and set
the content of a new MSHTML instance in your thread to the content
downloaded. This way, you don't have to wait for MSHTML to download the
document, and you can work with it right away.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com