Dave Hanna
Dave Hanna

Reputation: 2521

ASP Session variable vs ASP.NET Session variables

Okay, it’s an established fact that the Session object in ASP has no relation to the Session object in ASP.NET.

My question is this: If I have an ASP page, and it calls an ASPX page, which then does a Response.Redirect to another (or the same) ASP page, will the Session variables from the original ASP page be preserved in the final ASP page? Does anybody know the answer, or do I need to experiment and see?

Upvotes: 3

Views: 1707

Answers (4)

3Dave
3Dave

Reputation: 29041

will the Session variables from the original ASP page be preserved in the final ASP page?

Short answer: yes.

This is no different than if you left a page on your ASP site, used that browser window/tab to go to another site like Google, then came back. Your session will be preserved as long as it hasn't timed out or been collected, or any of the other standard things that can happen to invalidate a session.

The ASP and ASP.NET apps are effectively separate applications - almost separate sites, even if they live in the same folder structure - that happen to be running on the same server. They can't share data (without jumping through some hoops like storing things in a database) and aren't aware of each other.

Upvotes: 4

Jakkwylde
Jakkwylde

Reputation: 1302

Yes, the session will exist in asp classic in most circumstances. A few things to consider though:

  1. If the classic pages are not requested again before the SessionTimeout has been reached the instances will be destroyed
  2. If you're running on IIS 7 and redirecting between SSL and non SSL pages there may be different sessions in classic depending on the site configuration properties

Upvotes: 0

ianpoley
ianpoley

Reputation: 572

I don't believe your session variables will be destroyed unless you either close the browser or clear the session via code.

Upvotes: 0

Hector Minaya
Hector Minaya

Reputation: 1705

One way to share session variables between asp and asp.net is: http://www.eggheadcafe.com/articles/20021207.asp

Upvotes: 1

Related Questions