ASP.NET 2.0 Session_End Question

C

CK

We recently upgraded a 1.1 app to 2.0. We are experiencing a strange bug
that happens randomly. When a user is authenticated a string variable is
added to the session. During debugging I put a watch on this variable and
the sessionID. Strangley the sessionID goes in an out of scope, meaning
sometimes I have sessionID and sometimes shows an exception in the watch
window and Session is null. Anyways when the session terminates, I lose the
string variable. The session restarts and has the same sessionID however my
string variable is gone. Again this is so random. Can I see what's calling
Session_OnEnd and killing my variable? I know a couple workarounds but I
think this is part of a larger issue. Has anyone had any simliar
experiences? Some exception must be killing the session but
Application_OnError never fires. Any ideas?

TIA,
~CK
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

If the page doesn't use session state, the user won't be identified and
no Session object is associated with the request. Then you get a null
reference instead of the Session object.

If the page uses session state, you will always have a Session object.
Even if the session is terminated you will have a Session object, as a
new session will be started.

Alternating between pages with and without session state doesn't cause a
loss of the session. When you return to a page using session state you
will be identified again and get associated with the correct Session object.

If you lose the session variable, it sounds like the web server or the
application gets recycled. Some web servers are set to recycle daily or
even more often, but from the randomness it sounds more like it gets
recycled because of some performance problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top