Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP/ASP.NET Sessions

Posted on 2003-10-22
3
Medium Priority
?
548 Views
Last Modified: 2013-11-25
I'm going through a  pretty typical transition these days:  I have a large intranet chock-full of Classic ASP applications, and i'm now writing much nicer apps in ASP.NET with C#.  The problem of course is that ASP and the ASP.NET Process do not share a Session object.  Fortunately I'm having no problem sharing information between the two, i'm just coming up with an unusual bug and I'm not sure how to fix it.

When a user logs in to the intranet, the ASP Session receives their user ID and a couple of other tiny variables.  The ASP code that does that then forwards to an ASP.NET page that puts the same information into the ASP.NET Session.  So far so good.

I've found that the ASP.NET session keeps expiring if the user isn't browsing ASPX pages.  A user who spends 20 mintes (the current timeout) in a Classic ASP application will receive an error when they try to use an ASP.NET application because their User ID has disappeared from the ASP.NET session.

It was my impression that Session State would be preserved even if the user were browsing .HTML pages.  Any experts have a clue to what's going on here?  Your help is appreciated.

thanks
barryfandango
0
Comment
Question by:barryfandango
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Accepted Solution

by:
Jeffbub213 earned 300 total points
ID: 9604142
This is just a guess, but it would seem to me that the problem is because the ASP pages are running in one IIS application, while the ASP.NET pages are running in a sepearate IIS application. So by browsing ASP pages for 20 minutes, the ASP.NET application instance will remain idle for all this time.

I would guess that even in a normal site if you browse HTML pages for 20 minutes, then the session will expire. The reason for this would be that HTML files are by default mapped to a different DLL, so they will not be handled by the ASP engine, so there will not be anyway for it to know these pages are part of the application.

And since ASP and ASP.NET use different DLLS the same would apply.

As I said I'm not 100% sure if this is accurate, but it seems to make sense to me:) Hopefully it helps though.
0
 
LVL 2

Assisted Solution

by:cacklebunny
cacklebunny earned 200 total points
ID: 9624461
The way it SHOULD work in an ASP.NET environment is that once the ASP.NET session is initiated, it remains active for the duration of the browser session....as long as the user has his/her browser window open (and LESS than 20 minutes have transpired), the session will maintain state.    

However, just as you stated, if a user remains in a classic ASP environment on your website, the ASP.NET environment has no way of knowing that the user is still traversing the site because of the very same limitation regarding ASP and ASP.NET sessions...unfortunately this is by Microsoft's design....you will need to put a piece of code either in each individual ASP page that will update the ASP.NET engine or you'll need to add one piece of updating code inside your GLOBAL.ASA...whatever method you are using to share information between the two will have to continue even as the user traverses through ASP pages because -as you've discovered- how else will the ASP.NET engine know what the user is doing?

Another thing to keep in mind about both the classic ASP and the .NET session environments:  make sure you aren't running any extraneous anti-virus scanning on the web server, or have PC's that have anti-virus software running while also mapping folders to the web server....anti-virus scanning (especially if you have "scan network drives for viruses" enabled) will RESET the session every time.  There are other software products that, when installed on the web server and running in the background, will reset these sessions prematurely.

0
 
LVL 3

Author Comment

by:barryfandango
ID: 9624470
I split up the points.  Jeff, thanks for the guess, which looks to have been correct.  Bunny, thanks for the confirmation.

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question