i'm trying to use WebBrowser
in ASP.net
but i found an error from Thread
WebBrowser webget = new WebBrowser();
webget.Navigate("aaaaaa");
HtmlDocument d = webget.Document;
Console.WriteLine(d);
Console.Read();
The error is :
Unable to instantiate ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' because the current thread is not a single-threaded apartment (STA) thread.
this is an expected behavior as asp.net was designed for concurrency and will not mak any since using
STA
and this due to message pumpingtry this instead
if you are using this in asp.net you should do the following