Re: HttpContext.Current returns null



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 ....








.



Relevant Pages

  • Re: Calling .NET class from ASP
    ... Thank you, Phil, ... > Automation objects have a limited list of paramater types, and Request isn't ... >>> I have a .NET class that I want to call from an ASP page. ...
    (microsoft.public.dotnet.framework.interop)
  • Re: PKZIPC, ASP and WSH
    ... does NOT wait for it to finish processing before completing the ASP page ... Go to Services control panel applet and change both the "IIS Admin ... make a request to your ASP page ... Dynamic File, Directly Executable -- these are CGI EXE and ISAPI DLLs ...
    (microsoft.public.scripting.wsh)
  • Re: Double click
    ... I have a form that folks use to report ... >> written with asp, and it submits to an asp page, and the results are ... > the user clicks the submit button a second time, before the first request ... > been received by the server. ...
    (microsoft.public.inetserver.asp.db)
  • Re: Using Javascript to branch from one asp page to another and return
    ... It is not vbscript or ASP that is your problem. ... The browser sends a request and the server returns a response. ... If you want to have form2 ask the question and trigger form3 on the server ... You could have javascript send ...
    (microsoft.public.inetserver.asp.general)
  • Re: HttpContext.Current returns null
    ... Nicholas -- ... Yes, the OP could pass the intrinsic Request, Response, etc, etc ... looking to get the intrinsic objects from the static Current property on ... In classic ASP the solution I ...
    (microsoft.public.dotnet.languages.csharp)

Loading