session sharing from ASP to ASP.NET

A

abcd

I have an ASP application. It instantiaties some COM components and we put
those COM components in Session variables...COM components have license
restrictions...We have written new ASPX page ( for better GUI and faster
development) and we will be using that ASPX page along with our ASP
application...how can I pass that Session variable (which holds COM
instance) to ASPX page so that I will be working on same instance and will
not consume licenses....

thanks in advance

cheers !
 
S

Scott M.

Classic ASP pages and ASP.NET pages do not share session data. You must
create your own "bridge" between the two architectures.

One thought would be to use ASP.NET pages in place of the Classic ASP pages
that make the instances of the COM objects and use .NET COM InterOp to
instantiate the COM objects within the ASP.NET pages.
 
A

abcd

I can not change to ASP.NET pages to hold the COM instances. Its a huge
application and we dont want to spend more time on re-engineering. I have
added new functionaly in ASP.NET page and that requires the ASP session
variables...

any sanples !

Microsoft must have considered such design consideration when they developed
ASP.NET. as there are millions of asp based applications.

thanks
 
S

Scott M.

I'm sorry, but I'm not stating my opinion on this, it is a fact: Classic
ASP and ASP.NET do not share session data.

The reason is actually quite easy to understand. Classic ASP pages process
their code within the context of the Classic ASP "Engine" (ASP.dll). This
component is what exposes the familiar Classic ASP intrinsic objects
(Request, Response, Server, Application, Session & ASPError). ASP.NET
pages do not process using this engine. Instead they process via the
ASP.NET "Engine" (ASPNET_ISAPI.dll), which also exposes intrinsic objects
(like Application & Session) BUT they are NOT the SAME objects (not the same
instances and not the same memory addresses), so you may have 1 application
that has both .asp and .aspx pages in it and the .asp pages my be using
Session and the .aspx pages may also be using Session, but these are 2
different Session objects and there is no built in way to port data from one
to the other.

For most people who need to share session data, they will simply persist the
data to some common repository that both architectures can get at (such as a
database). But, since you are needing to persist not just name/value pairs
of data, but instead need to persist COM objects, this becomes more
difficult.

The only way you can use a COM object in ASP.NET is if you have a COM
reference to the COM object (thus creating a Runtime Callable Wrapper or
RCW) in the ASP.NET project. When this is done, you can instantiate the COM
object from within ASP.NET and use it (remembering to use the Marshall class
to release the COM object when you are done with it). But, to *pass* the
COM object to ASP.NET from Classic ASP, you'll need to find a place to store
the COM object that ASP.NET can get to and the Classic ASP Session object is
not it.
 
P

Patrick.O.Ige

Good info there Scott.
Patrick

Scott M. said:
I'm sorry, but I'm not stating my opinion on this, it is a fact: Classic
ASP and ASP.NET do not share session data.

The reason is actually quite easy to understand. Classic ASP pages process
their code within the context of the Classic ASP "Engine" (ASP.dll). This
component is what exposes the familiar Classic ASP intrinsic objects
(Request, Response, Server, Application, Session & ASPError). ASP.NET
pages do not process using this engine. Instead they process via the
ASP.NET "Engine" (ASPNET_ISAPI.dll), which also exposes intrinsic objects
(like Application & Session) BUT they are NOT the SAME objects (not the same
instances and not the same memory addresses), so you may have 1 application
that has both .asp and .aspx pages in it and the .asp pages my be using
Session and the .aspx pages may also be using Session, but these are 2
different Session objects and there is no built in way to port data from one
to the other.

For most people who need to share session data, they will simply persist the
data to some common repository that both architectures can get at (such as a
database). But, since you are needing to persist not just name/value pairs
of data, but instead need to persist COM objects, this becomes more
difficult.

The only way you can use a COM object in ASP.NET is if you have a COM
reference to the COM object (thus creating a Runtime Callable Wrapper or
RCW) in the ASP.NET project. When this is done, you can instantiate the COM
object from within ASP.NET and use it (remembering to use the Marshall class
to release the COM object when you are done with it). But, to *pass* the
COM object to ASP.NET from Classic ASP, you'll need to find a place to store
the COM object that ASP.NET can get to and the Classic ASP Session object is
not it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top