I was having a similar problem on my site. I wrote the
following to my ISP:
"...Assuming that you are using the in-process session
state mode and not the State Server or SQL Server modes, I
understand that session-state data is lost only if
aspnet_wp.exe or the application domain restarts. These
restarts commonly occur in the following circumstances:
1. Setting an attribute in the element of the
application's Web.config file that causes a new process to
start when a condition is met, such as memoryLimit.
2. The Global.asax or Web.config file is modified.
3. Changes to the \Bin directory of the Web application.
4. Antivirus software scans and modifies the Global.asax
file, the Web.config file, or a file in the \Bin directory
of the Web application.
5. If you enable Web garden mode in the element of the
application's Web.config file, and use in-process session-
state mode, random data loss can occur. Does your event
log file show anything regarding the conditions of startup?
...."
They wrote back the following:
"...Your apppool was recycling due to a Virtual Memory
limit that is in place with all the sites on this server.
We are in the process of deciding if this limit should be
raised and if so, to what number. We have doubled the
allowable virtual memory limit for your apppool. This
seems to have resolved the issue..."
This solved the problem for me. I'd be interested if it
solves the problem for you.
John Lewis
-----Original Message-----
I am having a problem with my session variable being set
to Null for no apparent reason.
I am declaring it like the following when the user logs
in.
dim objUserInfo as new clsUserInfo
'Set some properties
objUserInfo.UserName = txtUserName.text.trim
objUserInfo...
'Add it to session.
Session.Add("UserInfo",objUserInfo)
Then as I move from page to page all of the sudden it
randomly is null and I get a NullReferenceError.
Is it possible that it is being garbage collected? I
thought that all Session objects were supposed to last
until the Session_End method is called.
I know it has not been called because I can still
navigateto through the pages which don't use the session
information and my site is protected by forms
authentication.
This is very frustrating.
Please help.
Don't respond if you don't know what you are talking
about.
Billy Jacobs.
.