By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,069 Members | 1,716 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,069 IT Pros & Developers. It's quick & easy.

Intermittantly losing Session variables (but not even all of them)

P: n/a
I'm maintaining (read: I didn't write it, nor do I have the time to spend to
rewrite it) an application that is suddenly giving me grief.
The reason I say suddenly, is because we're in the process of transitioning
the server on which it runs from Microsoft Windows 2000 Server, to 2003
server (going from IIS 5 to IIS 6). This problem hasn't really occurred on
the 2000 server machine, but it's happening MUCH more on the new 2003 box
(not yet in production, thankfully).
Without going into too much detail, the application requires the user to
login, and once they've entered that, the data goes to a LOGIN.ASP page that
looks up that login/password, and if valid, gets a PersonID, and stores it
as a Session variable. It then redirects to the MAIN.ASP and never hits
LOGIN.ASP again (until the user logs out or is timed out after 4 hours).
In my GLOBAL.ASA, in the Session_OnStart() function, I'm setting some Server
variables, such as this one:

Session.Contents("Copyright") = " 2003. All rights reserved."

In the LOGIN.ASP, as mentioned before, it's storing the PersonID as well as
other information, such as follows (just with values hard-coded for this
example - in reality these are set based on the database query mentioned
before)

Session.Contents("PersonID")="123456"
Session.Contents("PersonName")="Fred"
If those variables were not set, it would fail when redirected to MAIN.ASP
(which has not been happening).

Now, here's the problem: Intermittantly, after the LOGIN.ASP page has been
long processed (and I've been in the web page for a little while, as little
as a few minutes), for no reason Session.Contents("PersonID") suddenly goes
blank. When I check the value of "PersonName", it too is blank.

But if I look at "Copyright" (set in the GLOBAL.ASA), that's intact.
What am I missing? How could it be losing just some of the Session
variables? Especially since the ones set in GLOBAL.ASA should be happening
first (and not again after that), and that the LOGIN.ASP ones are set later,
how are we losing the LOGIN.ASP-set ones without losing the GLOBAL.ASA ones
too?
I hope this isn't too confusing or convoluted.
Any ideas?
Thanks!

--
-Scott

(To e-mail me, just remove any color names from my posted e-mail, as well as
any extra periods)

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
If you lose a session then the session_onstart code will fire the next time
you hit a page so all of the session variables set in global.asa will always
be valid.

Check the system event logs to make sure something is not re-starting the
ASP application (some AV programs can inadvertently do this by scanning
global.asa all the time). Also, IIRC 2003 supports something called a
"web-garden" in which multiple threads (or maybe processes) are used to
process requests. I don't know if this has any impact on session variables
or not but you might play with the process isolation setting for the virtual
directory.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Scott Lyon" <sc************@blue.rapistan.green.com> wrote in message
news:41**********@Usenet.com...
I'm maintaining (read: I didn't write it, nor do I have the time to spend to rewrite it) an application that is suddenly giving me grief.
The reason I say suddenly, is because we're in the process of transitioning the server on which it runs from Microsoft Windows 2000 Server, to 2003
server (going from IIS 5 to IIS 6). This problem hasn't really occurred on
the 2000 server machine, but it's happening MUCH more on the new 2003 box
(not yet in production, thankfully).
Without going into too much detail, the application requires the user to
login, and once they've entered that, the data goes to a LOGIN.ASP page that looks up that login/password, and if valid, gets a PersonID, and stores it
as a Session variable. It then redirects to the MAIN.ASP and never hits
LOGIN.ASP again (until the user logs out or is timed out after 4 hours).
In my GLOBAL.ASA, in the Session_OnStart() function, I'm setting some Server variables, such as this one:

Session.Contents("Copyright") = " 2003. All rights reserved."

In the LOGIN.ASP, as mentioned before, it's storing the PersonID as well as other information, such as follows (just with values hard-coded for this
example - in reality these are set based on the database query mentioned
before)

Session.Contents("PersonID")="123456"
Session.Contents("PersonName")="Fred"
If those variables were not set, it would fail when redirected to MAIN.ASP
(which has not been happening).

Now, here's the problem: Intermittantly, after the LOGIN.ASP page has been
long processed (and I've been in the web page for a little while, as little as a few minutes), for no reason Session.Contents("PersonID") suddenly goes blank. When I check the value of "PersonName", it too is blank.

But if I look at "Copyright" (set in the GLOBAL.ASA), that's intact.
What am I missing? How could it be losing just some of the Session
variables? Especially since the ones set in GLOBAL.ASA should be happening
first (and not again after that), and that the LOGIN.ASP ones are set later, how are we losing the LOGIN.ASP-set ones without losing the GLOBAL.ASA ones too?
I hope this isn't too confusing or convoluted.
Any ideas?
Thanks!

--
-Scott

(To e-mail me, just remove any color names from my posted e-mail, as well as any extra periods)

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.