Spawn a new thread. Set that new thread to be STA and marshal the results back to your primary thread.
Richard > -----Original Message----- > From: Moderated discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED]]On Behalf Of James Crowley > Sent: 27 November 2002 20:49 > To: [EMAIL PROTECTED] > Subject: [ADVANCED-DOTNET] STAThread, COM interop and ASP.net > > > Hi, > > My component uses the WebBrowser control (via COM interop) to grab > certain bits of data from a web page. This works fine in a standard app, > but when I call it from an ASP.net page, you are told that we're not > using an STA thread, and the ActiveX control requires it. > > If I was writing an application with a Main() entry point, I'd just > stick in an [STAThread] attribute; but what do I do for my component? If > I add aspcompat=true to the ASP.net page, [which, I believe, puts > asp.net in STA mode] this sometimes works, sometimes hangs.... And I > really don't want customers to be having to stick in that tag for a > supposed .net component! > > Any suggestions? > > Thanks, > > ~ James Crowley > > Developer Fusion > ---------------------------------- > Web - http://www.developerfusion.com/ > Email - [EMAIL PROTECTED] > ICQ# - 60612011 > Fax - +44 (0)870 706 4042 > ---------------------------------- > > - > > You can read messages from the Advanced DOTNET archive, > unsubscribe from Advanced DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. > You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.