views:

446

answers:

4

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?

+1  A: 

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

hminaya
Thanks, but that wasn't really my question. I don't need to use any of the Session variables from ASP in the ASPX page, I just need to make sure they're not going to be destroyed when I come back to the ASP page. I had read that article before, and used it in some other applications. Good article.
Dave Hanna
A: 

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

ianpoley
+4  A: 

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.

David Lively
A: 

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
Jakkwylde