Solved

ASP/ASP.NET Sessions

Posted on 2003-10-22
3
545 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 75 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 50 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Hide cell in a table 2 45
Asp in server side with Mssql Server 7 4 43
MS SQL + date 6 54
SP converting date time to date and time separately 2 40
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…

752 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