473,385 Members | 1,342 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,385 software developers and data experts.

Loosing Session Variable

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 navigate
to 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.
Jul 21 '05 #1
7 7138
"Billy Jacobs" <bi********@csa.com> wrote in message
news:2a*****************************@phx.gbl...
I am having a problem with my session variable being set
to Null for no apparent reason.

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.


You could check into this:

http://groups.google.com/groups?hl=e...40TK2MSFTNGP10

Also, if IIS recycles I would imagine you would lose your session state.

-- Alan
Jul 21 '05 #2
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.
.

Jul 21 '05 #3
I doubt it since we have a dedicated server with 512 mg
of ram.
-----Original Message-----
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, Iunderstand 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 tostart 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 directoryof 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 beraised 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 setto 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

navigate
to 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.
.

.

Jul 21 '05 #4
Hello Billy,

Thanks for your post. As I understand, the problem you are facing session
lost problem in an ASP .NET application. Please correct me if there is any
misunderstanding. Based on my experience and research, there are a number
of possibilities that session will be lost:

1. Client related.
2. Sever application related (for example, timeout).
3. Session management problem (inproc, state server, sql server problem).
4. Some anti-virus application might also affect this.
5. Web form or web garden related.

The following KB articles describs the detailed information on session
lost. Please check them on your side:

PRB: Session Variables Are Lost Intermittently in ASP.NET Applications
http://support.microsoft.com/?id=316148

PRB: Session Variables Are Lost If You Use FRAMESET in Internet Explorer 6.0
http://support.microsoft.com/?id=323752

PRB: Session State Is Lost in Web Farm If You Use SqlServer or StateServer
Session Mode
http://support.microsoft.com/?id=325056

INFO: Do Not Store STA Objects in Session or Application
http://support.microsoft.com/?id=243543

PRB: Storing STA COM Component in Session Locks Session Down to Single
Thread
http://support.microsoft.com/?id=243815

FIX: Severe Performance Issues When You Bind Session State to Threads in
ASPCompat Mode
http://support.microsoft.com/?id=817005

IIS 6.0 Session State May Be Lost If You Use Web Gardens with ASP
Applications
http://support.microsoft.com/?id=822171

PRB: Session Data Is Lost When You Use ASP.NET InProc Session State Mode
http://support.microsoft.com/?id=324772

BUG: Session ID Is Lost When You Close a Browser Window
http://support.microsoft.com/?id=311072

I look forward to your result.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #5
1. Not the client. Happens on multiple machines.
2. Not a timeout. I am using forms authentication and can
still access other parts of the web that do not use the
Session variable.
3. Using the following:
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data
source=127.0.0.1;user id=sa;password="
cookieless="false"
timeout="20"
/>
4. MCafee (will dispable and see if this helps)
5. Dedicated Server. (No web farm)
-----Original Message-----
Hello Billy,

Thanks for your post. As I understand, the problem you are facing sessionlost problem in an ASP .NET application. Please correct me if there is anymisunderstanding. Based on my experience and research, there are a numberof possibilities that session will be lost:

1. Client related.
2. Sever application related (for example, timeout).
3. Session management problem (inproc, state server, sql server problem).4. Some anti-virus application might also affect this.
5. Web form or web garden related.

The following KB articles describs the detailed information on sessionlost. Please check them on your side:

PRB: Session Variables Are Lost Intermittently in ASP.NET Applicationshttp://support.microsoft.com/?id=316148

PRB: Session Variables Are Lost If You Use FRAMESET in Internet Explorer 6.0http://support.microsoft.com/?id=323752

PRB: Session State Is Lost in Web Farm If You Use SqlServer or StateServerSession Mode
http://support.microsoft.com/?id=325056

INFO: Do Not Store STA Objects in Session or Application
http://support.microsoft.com/?id=243543

PRB: Storing STA COM Component in Session Locks Session Down to SingleThread
http://support.microsoft.com/?id=243815

FIX: Severe Performance Issues When You Bind Session State to Threads inASPCompat Mode
http://support.microsoft.com/?id=817005

IIS 6.0 Session State May Be Lost If You Use Web Gardens with ASPApplications
http://support.microsoft.com/?id=822171

PRB: Session Data Is Lost When You Use ASP.NET InProc Session State Modehttp://support.microsoft.com/?id=324772

BUG: Session ID Is Lost When You Close a Browser Window
http://support.microsoft.com/?id=311072

I look forward to your result.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
.

Jul 21 '05 #6
Hello Billy,

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #7
Apparently it was the virus software causing the problem.
We turned it off of our web app directory and the problem
went away.

Thanks,

Billy Jacobs
-----Original Message-----
Hello Billy,

Thanks for your post. As I understand, the problem you are facing sessionlost problem in an ASP .NET application. Please correct me if there is anymisunderstanding. Based on my experience and research, there are a numberof possibilities that session will be lost:

1. Client related.
2. Sever application related (for example, timeout).
3. Session management problem (inproc, state server, sql server problem).4. Some anti-virus application might also affect this.
5. Web form or web garden related.

The following KB articles describs the detailed information on sessionlost. Please check them on your side:

PRB: Session Variables Are Lost Intermittently in ASP.NET Applicationshttp://support.microsoft.com/?id=316148

PRB: Session Variables Are Lost If You Use FRAMESET in Internet Explorer 6.0http://support.microsoft.com/?id=323752

PRB: Session State Is Lost in Web Farm If You Use SqlServer or StateServerSession Mode
http://support.microsoft.com/?id=325056

INFO: Do Not Store STA Objects in Session or Application
http://support.microsoft.com/?id=243543

PRB: Storing STA COM Component in Session Locks Session Down to SingleThread
http://support.microsoft.com/?id=243815

FIX: Severe Performance Issues When You Bind Session State to Threads inASPCompat Mode
http://support.microsoft.com/?id=817005

IIS 6.0 Session State May Be Lost If You Use Web Gardens with ASPApplications
http://support.microsoft.com/?id=822171

PRB: Session Data Is Lost When You Use ASP.NET InProc Session State Modehttp://support.microsoft.com/?id=324772

BUG: Session ID Is Lost When You Close a Browser Window
http://support.microsoft.com/?id=311072

I look forward to your result.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
.

Jul 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Sims | last post by:
Hi, I heard that there was a chance of 'loosing' a session ID between pages, (when the user clicks from one link to another). Is it really possible? Where could I find a definitive answer to...
1
by: Jonk Eidersteldvr | last post by:
Hi, I am using a web application -asp, ado, C#, using CodeBehind files etc.. I am using "InProc" session state and find that session variables are loosing their values between one web form and...
3
by: Windjammer | last post by:
I seem to be loosing my session variable as I move from one application to another The first application presents a menu of applications the user is authed for When I call the next application and...
2
by: Robert Berezka | last post by:
hi! I am working on a ASP.NET project. My problem with the session vaiable is: Localy on my client computer, where I develope my ASP.Net application, Everything runs fine. When I...
2
by: Aaric | last post by:
I am developing my web apps on a Win XP Pro SP2 laptop and then uploading them to a Windows Server 2003. My current project involves using session state variables to keep track of user after they...
7
by: Billy Jacobs | last post by:
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...
15
by: cyndi_r2000 | last post by:
Hi Everyone: I have a web application running on .NET 2.0 under IIS 6.0 and users of this application seem to be loosing their session randomly - we havent been able to identify any pattern,...
5
by: Mirovk | last post by:
The onclick action associated to my formīs radio buttons call to a vbscript were the session values are changed, this happens correctly but with the onclick action associated to my continue button...
1
by: Owen Richardson | last post by:
I have an asp.net website where i have a quick search facility built into my master page. the search is a web control, with a drop down country box and a list box full of cities. When i select...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.