session values lost in release mode

  • Thread starter Thread starter Priya
  • Start date Start date
P

Priya

Hi,

When i execute application in debug mode it works but on release mode the
session values in the website is lost. I use windows server 2003 and IIS 6.
It is a 5 step enrollment process whose values are carried forward across
pages. It throws error "object reference not set to instance of object and
points to session values" when moving across pages in release mode.
Pls advise.
Thanks
Priya
 
my cats said:
Session variables are

- memory that .net releases when it needs to = none of it is guaranteed

Sounds like you are refering to the Cache not the Session. Session
variables will remain until the session expires.
- useful to store temporary information
- with the intent of


try // the following is pseudo code

clsScrubMyData myScrubber = new clsScrubMyData();

if ( Session["myVar"] == null )
{
++NbrErors;
}
else
{
// the following is not perfect, thus the need for ++NbrErrors and
catch
int abc = myScrubber(Session["myVar']);
and so on
}

catch{ Exception lyBigFish )
{
++NbrErrors;
}
finally
{
if ( NbrErrors != 0 )
{
// you have to reinitialize the Session variable
Session["myVar"] = abcdefgh
and so on
}
}

If code in a page depends on previous pages having set up session variables
a simple test of Session.IsNewSession should be made. If true it would mean
that the previous session is likely to have expired.
 
Priya said:
Hi,

When i execute application in debug mode it works but on release mode the
session values in the website is lost. I use windows server 2003 and IIS
6.
It is a 5 step enrollment process whose values are carried forward across
pages. It throws error "object reference not set to instance of object and
points to session values" when moving across pages in release mode.


What exactly do mean by debug mode and release mode?
 
Back
Top