Re: HttpContext.Current returns null
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 10 Nov 2007 18:44:15 -0500
Liz,
The .NET class is being accessed by the VB6 class, as the OP stated.
Yes, the OP could pass the intrinsic Request, Response, etc, etc objects from the VB6 object to the .NET class, but from the original post, it doesn't seem the OP wants to do that. This is because the OP is looking to get the intrinsic objects from the static Current property on the HttpContext class. This is how you get the intrinsic objects in ASP.NET. In classic ASP (which is what this is running in) the solution I provided is how you would get the intrinsic objects.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"Liz" <liz@xxxxxxxxxxxxxxx> wrote in message news:O2QwhV9IIHA.588@xxxxxxxxxxxxxxxxxxxxxxx
"Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:DCDD782F-9DA1-4436-A4E6-B4EDC011E90D@xxxxxxxxxxxxxxxx
Liz,
No, you can't. The Request, Response, etc, etc, objects in ASP are completely different than they are in ASP.NET. ASP.NET doesn't improve or enhance ASP (technically), it completely replaced it.
Because of that, you have to get the intrinsic objects the way you would do in ASP, which is what I pointed out, using some of the wrappers that .NET provides for accessing COM+.
A COM component accessed in ASP would have to do the same thing to get the Request, Response, etc, etc properties.
Nicholas -
the OP said they are running a legacy ASP application ... so he's got direct access to Request; what he's doing with his VB6 COM component + his C# assembly is not specified ... it all sounds very contorted and I am wondering if it needs to be ... in all events, so far as I can see from what was posted, the question isn't really about ASP.NET at all as they don't appear to be using it. If he needs to pass anything from Request to his VB component, I should think he can, no?
Are you assuming this all refers to an app being converted to ASP.NET? maybe it is, but the post doesn't say that ... why there is a C# assembly in the picture I have no idea ... but people decide to do all kinds of things for all kinds of reasons, some of them better than others
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"Liz" <liz@xxxxxxxxxxxxxxx> wrote in message news:%23C2wom1IIHA.588@xxxxxxxxxxxxxxxxxxxxxxx
"Gilgamesh" <gilgamesh4ever@xxxxxxx> wrote in message news:uv398jwIIHA.4272@xxxxxxxxxxxxxxxxxxxxxxx
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?
you can't just access Request directly in the legacy ASP app? isn't this what you call the really long way around? which gets even worse when Nicholas explains what it takes to do it?
hope that VB6 and C# code is doing something really useful ....
.
- Follow-Ups:
- Re: HttpContext.Current returns null
- From: Liz
- Re: HttpContext.Current returns null
- References:
- HttpContext.Current returns null
- From: Gilgamesh
- Re: HttpContext.Current returns null
- From: Liz
- Re: HttpContext.Current returns null
- From: Nicholas Paldino [.NET/C# MVP]
- Re: HttpContext.Current returns null
- From: Liz
- HttpContext.Current returns null
- Prev by Date: Re: getting menu items
- Next by Date: Re: Form Background not properly displayed
- Previous by thread: Re: HttpContext.Current returns null
- Next by thread: Re: HttpContext.Current returns null
- Index(es):
Relevant Pages
|
Loading