471,348 Members | 1,358 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

How to use [STAThread] in web application?

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
Jan 25 '06 #1
1 4545
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"anadimpa" <an******@discussions.microsoft.com> wrote in message
news:C1**********************************@microsof t.com...
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

Jan 25 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by sonu | last post: by
3 posts views Thread by Justine | last post: by
1 post views Thread by Alberto | last post: by
2 posts views Thread by Tom | last post: by
1 post views Thread by Larry Lard | last post: by
22 posts views Thread by Martijn Mulder | last post: by
12 posts views Thread by rafalK | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.