473,587 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4950
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.co m

"anadimpa" <an******@discu ssions.microsof t.com> wrote in message
news:C1******** *************** ***********@mic rosoft.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2711
by: sonu | last post by:
Hi I have developed a smart client application. When i try to execute it. It displays the first form which is the login screen. On giving the corrent login id and password, the main form opens. It has 2 menus. On clicking the submenu, it throws an STAThread exception. The error details are given below. I have included ...
3
2177
by: Justine | last post by:
hi all, i just want to know the significance of in the C# application. Why & for What reason is this used. Thanz in Advance, Justine
9
6317
by: | last post by:
Hi All, I have allready tried to ask a similar question , but got no answer until now. In the meantime, I found, that I cannot understand some thread-settings for the Main() function . If I use the attribute for the Main() function, I get "access denied error", if I use a ManagementEventWatcher to connect to the local machine to receive...
1
8410
by: Alberto | last post by:
What's the meaning of the STAThread attribute? Thanks
2
3092
by: Tom | last post by:
Do we need to put the STAThread attribute on our Sub Main anymore if we are using the 1.1 Framework? See some YEAs and NEAs when searching on Google so thought I would ask here. Tom
1
3580
by: Larry Lard | last post by:
Just now I translated Jon Skeet's WaitHandle.WaitAny / .WaitAll (<http://yoda.arachsys.com/csharp/threads/waithandles.shtml>) from C# into VB.NET, and after the first go I ran into trouble: (from the docs for WaitHandle.WaitAll) >> NotSupportedException The number of objects in waitHandles is greater than the system permits. -or-
22
737
by: Martijn Mulder | last post by:
What is the penalty if I do not put just above the Main() method?
4
19452
by: garyusenet | last post by:
I am at a loss with this. I tried to go back to basics, and start learning all i didn't understand, starting at the top of the code file generated by VS. But I can't seem to get any sort of start on this problem, anything I read on the NET goes too far above my head to be of any use. For instance typical explanations say things like... ...
12
5049
by: rafalK | last post by:
Hi All, I have a big problem with STAThread attribute. I'm using XNA framework connected with WinForms. XNA is working in non STAThread. I have a problem with displaying CommonDialog forms e.g. OpenFileDialog. I can't declare a main method as STAThread because of XNA framework. Is there any way to declare form or some method in form as...
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7849
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8215
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8347
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5718
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3844
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.