Gilgamesh,
Your assumption about the object context not being passed from the VB
dll to the C# dll is incorrect. In ASP.NET, it doesn't know anything about
the HttpContext class, so it's natural that the static Current property
returns null.
Rather, you will have to get the ASP intrinsic objects from COM+.
To do this, you will have to add a COM interop assembly to your project
for "Microsoft Active Server Pages Object". You will also have to set a
reference to System.EnterpriseServices.dll in your project.
Once you do that, when you need to access one of the intrisic object,
you will use the ContextUtils class in the System.EnterpriseServices
namespace. From there, you can call the GetNamedProperty method, passing
"Request", "Response", "Session", "Application", or "Server" to get the
appropriate intrinsic object. Cast the return value to the appropriate
interface type in the type library you created the interop assembly for, and
you should be able to use the ASP intrinsic object from there.
For more information on how to do this in VB6, see the following
article:
http://www.stardeveloper.com/articles/display.html?article=2000041401&page=1
This points out how you do it in VB6. The ContextUtil class in .NET
will handle the interaction with the ObjectContext, you just have to cast it
to the right return value.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Gilgamesh said:
We have a legacy ASP application which is calling a VB 6 DLL. This dll
then calls a C# dll assembly written in .net 2.0. We need to access
httpcontext in C# in order to get the request object associated with the
ASP page which initiated the request. HttpContext.Current retunes null in
C#, which indicates that the object context is not being passed from vb
dll to C# dll. Any idea why is this happening?
Thanks,
Gilgamesh