Chris Cannon
Chris Cannon

Reputation: 1167

How Can I Use Classic ASP Session Object in ASP.NET to Read Session Variables

Background:

  1. I'm developing an ASP.NET application for a classic ASP website
  2. User authentication is performed by the classic ASP website
  3. The classic ASP website stores data in session variables to identify authenticated users
  4. I need to read the data in those session variables in my ASP.NET application

Many articles say that you need to store session state in a database in order to do this.

None of them have mentioned about using VBScript objects from within the VB.NET code.

Is it possible to do this? Can I not simply reference a COM library in my application and use the objects and their methods? If not, how come?

Upvotes: 2

Views: 3356

Answers (2)

Paul
Paul

Reputation: 1066

Several solutions..., here is a recent one

http://weblogs.asp.net/lichen/archive/2011/10/30/sharing-session-between-asp-classic-and-asp-net-using-asp-net-session-state-server.aspx

There are also other solutions, google for session share asp.net asp you'll find many solutions including solutions by ms herself.

Upvotes: 1

Richthofen
Richthofen

Reputation: 2086

Session variable values are not just the result of a function call. They depend on IIS and other tools to uniquely identify the user. It isn't possible to directly retrieve session state across these two frameworks.

Of course, depending on how sensitive the data is,you could hack it. Make an Ajax call in the background to retrieve session data from a custom page and feed it into the .NET session. It's a hack and a security risk, but it would work.

Upvotes: 3

Related Questions