B
Boban Dragojlovic
I'm building a complex web-based reservations system.
Gathering the user's data requires between 8 and 15 pages (depending on
which options they are interested in). I use the "Session" object to store
the various elements as the user moves through the pages.
Rather than storing the preferences directly in the Session object (e.g.
Session("LastName") = ...), I created a class
<Serializable()> Public Class ReservationInfo
This class has private variables for all the data, and exposes properties to
retrieve/manipulate the data. I did this for several reasons:
* I don't have to worry about screwing up variable names from one page
to the next (is it Session("OptionNumber") or is it Session("OptionNbr")) --
* I can add some logic related to the assignment of properties (e.g. if
a property changes, I might need to reset other properties)
In one of my modules I declare
dim g_Info as ReservationInfo
And on each page, then, in the OnLoad event, I have something to this
effect:
g_Info = Current.Session("ReservationInfo")
(actually, in the OnLoad event I call a public sub in one of my
modules, and it does the retrieval. That's why it references
Current.Session)
and in the Unload event, I have
Session("ReservationInfo") = g_Info
This way my entire set of variables is loaded from the Session, and saved
back to the session each time.
I let .NET manage the Session object in memory (single server), and
everything works great (or at least it did during my development/testing).
The problem happened when we ran the first multi-user test (e.g. 5 people
testing at the same time).
Suddenly, as users moved from page to page, their session information was
getting swapped with the information from another user. Every so often
(every couple of pages or so), as you moved from one page to another, you
suddenly wound up with the data of another user on the system.
I then added logic so that in the unload event, it would serialize and dump
the entire g_Info object to disk, and the filename would be based on the
SessionID of the user. That way I could trace the session information of
each user as they moved from page to page. I've confirmed that this happens
there. It seems that when it retrieves the data from the Session object
g_Info = Current.Session("ReservationInfo")
it sometimes grabs the wrong data.
I've analyzed several hundred page requests, and found many occurrences, but
can't find any pattern to it.
I don't have a clue how this could be. Any ideas?
Gathering the user's data requires between 8 and 15 pages (depending on
which options they are interested in). I use the "Session" object to store
the various elements as the user moves through the pages.
Rather than storing the preferences directly in the Session object (e.g.
Session("LastName") = ...), I created a class
<Serializable()> Public Class ReservationInfo
This class has private variables for all the data, and exposes properties to
retrieve/manipulate the data. I did this for several reasons:
* I don't have to worry about screwing up variable names from one page
to the next (is it Session("OptionNumber") or is it Session("OptionNbr")) --
* I can add some logic related to the assignment of properties (e.g. if
a property changes, I might need to reset other properties)
In one of my modules I declare
dim g_Info as ReservationInfo
And on each page, then, in the OnLoad event, I have something to this
effect:
g_Info = Current.Session("ReservationInfo")
(actually, in the OnLoad event I call a public sub in one of my
modules, and it does the retrieval. That's why it references
Current.Session)
and in the Unload event, I have
Session("ReservationInfo") = g_Info
This way my entire set of variables is loaded from the Session, and saved
back to the session each time.
I let .NET manage the Session object in memory (single server), and
everything works great (or at least it did during my development/testing).
The problem happened when we ran the first multi-user test (e.g. 5 people
testing at the same time).
Suddenly, as users moved from page to page, their session information was
getting swapped with the information from another user. Every so often
(every couple of pages or so), as you moved from one page to another, you
suddenly wound up with the data of another user on the system.
I then added logic so that in the unload event, it would serialize and dump
the entire g_Info object to disk, and the filename would be based on the
SessionID of the user. That way I could trace the session information of
each user as they moved from page to page. I've confirmed that this happens
there. It seems that when it retrieves the data from the Session object
g_Info = Current.Session("ReservationInfo")
it sometimes grabs the wrong data.
I've analyzed several hundred page requests, and found many occurrences, but
can't find any pattern to it.
I don't have a clue how this could be. Any ideas?