Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP/ASP.NET Sessions

Posted on 2003-10-22
3
Medium Priority
?
549 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 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

885 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