Re: ASP.NET 2.0 Session_End Question

Tech-Archive recommends: Speed Up your PC by fixing your registry



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.

CK wrote:
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

.



Relevant Pages

  • Re: Intranet Login using ASPdotNET (advice)...
    ... You should read a bit about FormsAuthentication ... limit the scope of the session object? ... You should use the Session object, the Cache object has a different ... How do I set the session to expire in XX minutes? ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Access session of another user
    ... user's session by a session id or user id, ... I strongly recommend you to use the Profile ... Profile object is persistent whereas Session object is non-persistent. ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Classes / Functions / Autonomy
    ... Session creation should be called from the Validate function, ... Session Object. ... Class Celebrity { ...
    (comp.lang.php)
  • Re: threading and iterator crashing interpreter
    ... "restricted mode" means that the current builtins are not the standard ... Googling says "Some googling suggests that this error is a hint that a ... ("session" in this case) ... happening is the Session object is deallocated, ...
    (comp.lang.python)
  • Re: pls help w/cookies.......
    ... into a session object in the server side). ... the output of the handler servlet contains a link to a viewer ...
    (comp.lang.java.help)