Looking to settle an argument here.
All the stuff I\'ve read on using a COM object created in VB from an ASP.NET page is surrounding with
WARNING - MAKE
Sure you can use a VB COM component in an ASP.NET application. You think that millions of lines of VB code aren't going to get any love in .NET-land? :)
VB COM components are notorious for being compiled using a Single Threaded Apartment (STA) - though not always the case (if I remember correctly).
When using a STA VB component in .NET you might find that you experience:
An easy way to determine MTA v. STA for a thread is to leverage Windbg, connect to the process, load SOS, and execute !threads. You'll see output similar to:
0:015> !threads
ThreadCount: 27
UnstartedThread: 0
BackgroundThread: 17
PendingThread: 0
DeadThread: 10
Hosted Runtime: no
PreEmptive GC Alloc Lock
ID OSID ThreadOBJ State GC Context Domain Count APT Exception
15 1 a28 000d75f0 1808220 Enabled 3823b58c:3823bb08 000d3fe8 0 STA (Threadpool Worker)
19 2 43c 000dd5f0 b220 Enabled 00000000:00000000 000d3fe8 0 MTA (Finalizer)
20 3 b94 000f20b0 80a220 Enabled 00000000:00000000 000d3fe8 0 MTA (Threadpool Completion Port)
21 4 15c 000f5318 1220 Enabled 00000000:00000000 000d3fe8 0 Ukn
Note that one of threads has "STA" listed in the APT column. This thread is a STA thread and your likely to see your VB COM code on its call stack.
References discussing the problem:
Good Luck!
Z