I'm not sure this will be of much help but are you using the AspCompat
attribute on the ASP.NET Page?

--
Patrick Steele
http://weblogs.asp.net/psteele



-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Ryan Parlee
Sent: Friday, October 20, 2006 6:58 AM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: [ADVANCED-DOTNET] ASP.NET calling into VB COM loses
applicatoin-user context


Hello,

I have an ASP.NET application that needs to call into a VB6 component
(for which I cannot modify).  This VB6 component reads a ProgId from a
configuration setting and instantiates and calls my .NET CCW object. The
problem is that when the call from the VB6 COM object to the .NET
component is made, the .NET component can no longer access the original
HttpContext.Current.

In order for the HttpContext.Current to work correctly, the returned
method call from VB6 COM trough the CCW needs to be 1) on the same
original thread and 2) has to be in the same AppDomain (?Is that right?)

At first, I didn't think about the thread issue and just noticed that
ASP.NET creates a different AppDomain for each application so my
original ASP.NET application is running in a named AppDomain, something
like /LM/W3SVC/1/Root-asdfasdfasdf.  COM Interop, on the other hand,
apparently always uses the DefaultAppDomain so when the call from VB6
COM is marshaled into the CLR that's where it gets created.

Using Remoting I successfully got my object to be created in the same
original AppDomain, but of course that did not work because Remoted
objects always incur a thread switch (?Is that right?)

I then realized that there were actually two three thread switches going
on: one between the original .NET object and the VB6 COM object, another
when the VB6 COM object calls back into .NET, and the last one between
the call from the Remoted Client to the Remoted Server component.


So my question is this: Is it possible to call from .NET to VB6 and then
back to .NET on a single thread and within the same AppDomain?

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to