469,609 Members | 1,230 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

session data missing

I have a asp.net 2/c# web database application which works fine, but
ocassionaly sesion data just dissapears. It's not any timeout as it happens
in the middle of work on it, and I just get 2 possible erros - obj ref not
set... cause the object in sesion no longers exists or it forwards users to
the log on page. as it happens frequently during the work it became a very
big problem, and I have no idea what could cause it.
pls help :)
Oct 25 '07 #1
9 1134
"Nedim" <Ne***@discussions.microsoft.comwrote in message
news:EB**********************************@microsof t.com...
>I have a asp.net 2/c# web database application which works fine, but
ocassionaly sesion data just dissapears. It's not any timeout as it
happens
in the middle of work on it, and I just get 2 possible erros - obj ref not
set... cause the object in sesion no longers exists or it forwards users
to
the log on page. as it happens frequently during the work it became a very
big problem, and I have no idea what could cause it.
When it happens, does it happen for all users at the same time...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 25 '07 #2
Hi Nedim,

Session is lost if you are working on it (like compiling incase of Web
Application/ Changing Web.config etc). In otherwords once Application is
Restarted for any reason Session is lost.

You can work around this issue by using Out of Proc Session server
(aspnet_state.exe), then you can work freely.

Best Regards,
Parag
http://iparag.com
Nedim wrote:
I have a asp.net 2/c# web database application which works fine, but
ocassionaly sesion data just dissapears. It's not any timeout as it happens
in the middle of work on it, and I just get 2 possible erros - obj ref not
set... cause the object in sesion no longers exists or it forwards users to
the log on page. as it happens frequently during the work it became a very
big problem, and I have no idea what could cause it.
pls help :)
Oct 25 '07 #3
No, to some it happens to some not, but always at a different time for each
user.
And nobody touches the web server at that time - no web.config changes, iis
restars and similar stuff

"Mark Rae [MVP]" wrote:
"Nedim" <Ne***@discussions.microsoft.comwrote in message
news:EB**********************************@microsof t.com...
I have a asp.net 2/c# web database application which works fine, but
ocassionaly sesion data just dissapears. It's not any timeout as it
happens
in the middle of work on it, and I just get 2 possible erros - obj ref not
set... cause the object in sesion no longers exists or it forwards users
to
the log on page. as it happens frequently during the work it became a very
big problem, and I have no idea what could cause it.

When it happens, does it happen for all users at the same time...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 25 '07 #4
"Nedim" <Ne***@discussions.microsoft.comwrote in message
news:A6**********************************@microsof t.com...
>"Nedim" <Ne***@discussions.microsoft.comwrote in message
news:EB**********************************@microso ft.com...
>I have a asp.net 2/c# web database application which works fine, but
ocassionaly sesion data just dissapears. It's not any timeout as it
happens
in the middle of work on it, and I just get 2 possible erros - obj ref
not
set... cause the object in sesion no longers exists or it forwards
users
to
the log on page. as it happens frequently during the work it became a
very
big problem, and I have no idea what could cause it.

When it happens, does it happen for all users at the same time...?
No, to some it happens to some not, but always at a different time for
each
user.
And nobody touches the web server at that time - no web.config changes,
iis
restars and similar stuff
OK, so we can eliminate the app cycling since that would affect all users at
the same time...

Do you have any code which tears down a user's session by calling
Session.Abandon(), maybe when a user logs out...? Could this be being called
unexpectedly...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 25 '07 #5
No, there is no sign out code at all, as i have very stupid users, and they
exit via closing the browser (or just shutting down the computer).

"Mark Rae [MVP]" wrote:
"Nedim" <Ne***@discussions.microsoft.comwrote in message
news:A6**********************************@microsof t.com...
"Nedim" <Ne***@discussions.microsoft.comwrote in message
news:EB**********************************@microsof t.com...

I have a asp.net 2/c# web database application which works fine, but
ocassionaly sesion data just dissapears. It's not any timeout as it
happens
in the middle of work on it, and I just get 2 possible erros - obj ref
not
set... cause the object in sesion no longers exists or it forwards
users
to
the log on page. as it happens frequently during the work it became a
very
big problem, and I have no idea what could cause it.

When it happens, does it happen for all users at the same time...?
No, to some it happens to some not, but always at a different time for
each
user.
And nobody touches the web server at that time - no web.config changes,
iis
restars and similar stuff

OK, so we can eliminate the app cycling since that would affect all users at
the same time...

Do you have any code which tears down a user's session by calling
Session.Abandon(), maybe when a user logs out...? Could this be being called
unexpectedly...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 25 '07 #6
"Nedim" <Ne***@discussions.microsoft.comwrote in message
news:32**********************************@microsof t.com...
>Do you have any code which tears down a user's session by calling
Session.Abandon(), maybe when a user logs out...? Could this be being
called
unexpectedly...?
No, there is no sign out code at all, as i have very stupid users, and
they
exit via closing the browser (or just shutting down the computer).
Starting to run out of ideas now...

Do you have any code at all which removes and/or modifies Session variables?

Are you using Forms Authentication?

Do you receive a notification of every error?

Can you discern any pattern to this?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 25 '07 #7
well so far i couldn't see any pattern. i use forms authentification, below
is the web.config snippet. i receive notification when obj ref exception
occurs, but it doesnt help much. the only place where session data is being
written is after the login, when i put all the data regarding the logged on
user in a session object. after that i retrieve that data with
object UserData = System.Web.HttpContext.Current.Session["UserData"];

web.config:
<authentication mode="Forms">
<forms name=".ASPXAUTH" loginUrl="Login.aspx"
defaultUrl="forme/home/Default.aspx" protection="All" timeout="60"
path="/"></forms>
</authentication>
and this it the code that creates the object in session (which we use later
on as static property, Korisnik is the name of the class in app_code)

public static Korisnik Trenutni
{
get
{
object oKorisnik =
System.Web.HttpContext.Current.Session["korisnik"];
if (oKorisnik != null)
return ((Korisnik)oKorisnik);
else
return null;
}
}
"Mark Rae [MVP]" wrote:
"Nedim" <Ne***@discussions.microsoft.comwrote in message
news:32**********************************@microsof t.com...
Do you have any code which tears down a user's session by calling
Session.Abandon(), maybe when a user logs out...? Could this be being
called
unexpectedly...?
No, there is no sign out code at all, as i have very stupid users, and
they
exit via closing the browser (or just shutting down the computer).

Starting to run out of ideas now...

Do you have any code at all which removes and/or modifies Session variables?

Are you using Forms Authentication?

Do you receive a notification of every error?

Can you discern any pattern to this?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 25 '07 #8
"Nedim" <Ne***@discussions.microsoft.comwrote in message
news:20**********************************@microsof t.com...
creates the object in session (which we use later on as static property
Whenever I see the words "session" and "static" in the same sentence, the
alarm bells immediately go off... :-)

Can you confirm that you are *not* creating static session variables...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 25 '07 #9
The user variable is in session, the only thing is we access the object in
session through static variable.

public static Korisnik Current
{
get
{
object oKorisnik =
System.Web.HttpContext.Current.Session["korisnik"];
if (oKorisnik != null)
return ((Korisnik)oKorisnik);
else
return null;
}
}

"Mark Rae [MVP]" wrote:
"Nedim" <Ne***@discussions.microsoft.comwrote in message
news:20**********************************@microsof t.com...
creates the object in session (which we use later on as static property

Whenever I see the words "session" and "static" in the same sentence, the
alarm bells immediately go off... :-)

Can you confirm that you are *not* creating static session variables...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 25 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Paul | last post: by
14 posts views Thread by Paul Yanzick | last post: by
3 posts views Thread by Efrain Flores | last post: by
7 posts views Thread by Spencer H. Prue | last post: by
9 posts views Thread by charliewest | last post: by
7 posts views Thread by Mr Newbie | last post: by
10 posts views Thread by stathisgotsis | last post: by
11 posts views Thread by Dave | last post: by
13 posts views Thread by Samir Chouaieb | last post: by
5 posts views Thread by gom | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.