views:

223

answers:

2

I don't know if it's possible, but suppose you want to handle reading/writing of cookies on a classic ASP page from a COM object. The COM object is written in .net and wrapped with a COM interface to make it accessible from classic ASP.

For clarification - my question is this:

Is it possible to access the ASP context inside a .net assembly wrapped with a COM interface, when you access it from a classic ASP Page like this:

Set controller = Server.CreateObject("MyNameSpace.MyClass")
my cookievalue = controller.GetSpecialCookieValue()

This example is an example of accessing the httpcontext's cookie information.

+1  A: 

I guess you will need to reference Microsoft Active Server Pages Object Library.

See if this helps.
IMO, you should not set cookies from COM component.

shahkalpesh
"you should not set cookies from COM component." Why??
AnthonyWJones
That should better be done in the right context - inside an asp page.
shahkalpesh
I ended up not accessing the ASP context anyways. I actually was against this from the beginning so... well problem solved :)
Per Hornshøj-Schierbeck
@shahkalpesh: Why is ASP page the "right context"? I can't subscribe to this POV. A COM component is merely a means to package some code, I can't see any reason why that code can't deeply coupled with ASP components if that is appropriate to the task of the code. Its often a good choice (assuming you own the server) than leaving that same code in a script language.
AnthonyWJones
Saul Dolgin
@Anthony: The reason I say it has to be a ASP page, is because of deep coupling the COM component will have with the ASP objects. Your point makes sense too (what is there to worry about when its our own server?).
shahkalpesh
A: 

See my answer to a another asp-classic question here.

AnthonyWJones
Perhaps you solution was better, I don't know...
Per Hornshøj-Schierbeck