473,326 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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

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
1 2756
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: vivek | last post by:
Do any of you guys have any idea what might be the reason for losing session variables, i was working on a page where i had to stroe a array in a session(trust me that was the only 'way' i could...
1
by: wekrato | last post by:
Hi! I want to do a comfortable way of importing a file into my system via a webpage. When importing, the following three components run at the same time: - ImportStatus which shows how far the...
9
by: Adrian Parker | last post by:
We have a website that works everywhere but on a few PCs on this one site.. Asp.Net 1.1 Server = Windows 2003 Client = XP In the web.config we use - cookieless="false" in the browser settings...
0
by: Jimmy Reds | last post by:
Hi, Sorry if this appears twice but I post through Google Groups and it had a funny 5 minutes and didn't appear to post this message the first time. I am setting session variables on a page...
2
by: Jimmy Reds | last post by:
Hi, I am setting session variables on a page then doing a header/location redirect to a second page however I am losing one of my session variables. Not all of them, just one. Here are some...
2
by: Geoff Berrow | last post by:
I have a page containing a form. The page submits to itself and if the data validates, stores the posted variables into a database and also into a session. I then use header to redirect to...
0
by: jason.friesen | last post by:
Hi Folks I have a custom CMS built in classic ASP that is losing session variables. To wit, I can create a situation where my 'show all the set SVs' test page shows a different set of SVs on each...
9
by: Schraalhans Keukenmeester | last post by:
I am stomped with the following problem: I have a script start.php and a second script proceed.php Relevant (and working) sections of the code: start.php <?PHP start_session();
1
by: KidQuin | last post by:
I am having problems with session value between pages. Happening in both firefox and IE7. I go between page by links so I know it's not header changes. I use session_start as the first line on the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.