ASP/ASP.NET Sessions

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
LVL 3
barryfandangoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffbub213Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cacklebunnyCommented:
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
barryfandangoAuthor Commented:
I split up the points.  Jeff, thanks for the guess, which looks to have been correct.  Bunny, thanks for the confirmation.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.