How to use [STAThread] in web application?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I am using a COM object which requires the use of Single Thread Apt.. I
have used this before in Windows/Console applications which have the Main[]
methods

[STAThread]
static void Main(string[] args)....

How can I use this in a regular web page?

thanks
 
Adi,

In ASP.NET, you should not set the threading model for the threads.
Rather, if you have to use a STA component, set the AspCompat attribute on
the page directive to true, like so:

<%@ Page AspCompat="true" %>

This can have an impact on performance, and if possible, you should
migrate the code to .NET.

Hope this helps.
 

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

Back
Top