Session Loss

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    Session Loss

    I'm currently facing a problem where in my Session is recycled (well it's stopped...that much I can determine from being logged out and by putting debugging statements into the Global.asax Session_End function).

    I have stepped through the function that causes this to happen but don't see any signs of what would cause the Session to crash.

    Does anyone have any hints on how to figure out what is crashing my session?
    I'm really stumped as to how to debug this.

    Thanks
    -Frinny
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Update on this issue:

    Debugging Session loss is harder than I expected it to be.

    Using the Global.asax and a debugging tool I was able to track down what was causing my problem.

    I put debugging statements into Application_Sta rt, Application_End and Session_End methods to determine how my session was crashing. From this I was able to tell that my Session was ending but that the Application wasn't being restarted...the refore I knew that the cause to my Session Loss wasn't from the AppDomain being restarted (nor was it being caused by my application restarting).

    I downloaded a tool called Debug Diagonostics that helped me watch my asp worker process....from here I was able to tell that my worker process wasn't being recycled.

    My advice to people attempting to debug Session Loss/ Session Crash is to use the Debug Diagnostic tool to monitor your application for memory leaks etc which may cause the worker process to be recycled by your IIS.

    I would also recommend making use of the Global.asax functions to monitor what is happening to your application ...watch for things like when your application is Started or Ended... this could an indicate that your AppDomain or Application is being reset by IIS. And put in as many debugging statements as possible into your Global.asax file since it monitors the application itself.

    Good luck solving your Session Loss problems in the future!

    -Frinny

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Last update:

      I solved my problem!
      It turned out to have nothing to do with session at all...but rather it was an issue regarding authentication.

      No wonder it was so hard for me to debug :P

      -Frinny

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        So what was authentication doing? Where you losing the windows auth?

        Hehe, I use a similar one in the start event:
        Code:
        void Application_End(object sender, EventArgs e) 
        {//  Code that runs on application shutdown
           string ipmsg= "127.0.0.1";
           ipmsg= ipmsg.PadRight(15, ' ');
           GlobalVars.LogMsg(ipmsg+" tried to Application/Shutdown");
        }

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          Originally posted by Plater
          So what was authentication doing? Where you losing the windows auth?

          Hehe, I use a similar one in the start event:
          Code:
          void Application_End(object sender, EventArgs e) 
          {//  Code that runs on application shutdown
             string ipmsg= "127.0.0.1";
             ipmsg= ipmsg.PadRight(15, ' ');
             GlobalVars.LogMsg(ipmsg+" tried to Application/Shutdown");
          }
          There was an error in my authentication logic which only happens during a specific change...theref ore it didn't authenticate properly and my code logged out the user...and killed user's session on purpose to prevent further execution.

          Comment

          Working...