Solved

ASP/ASP.NET Sessions

Posted on 2003-10-22
3
539 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
3 Comments
 

Accepted Solution

by:
Jeffbub213 earned 75 total points
Comment Utility
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 50 total points
Comment Utility
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
Comment Utility
I split up the points.  Jeff, thanks for the guess, which looks to have been correct.  Bunny, thanks for the confirmation.

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now