Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Windows Server 2003 SP2 Broke My Site

Windows Server 2003 SP2 Broke My Site

Scheduled Pinned Locked Moved Web Development
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    achimera
    wrote on last edited by
    #1

    I have a classic ASP web site that has been running flawlessly for at least 6 years now. I updated Windows Server 2003 to SP2 a few days ago, and now a "session counter" that I had implemented in Global.asa no longer works. Here is the code. From Global.asa:

    function Application_OnStart()
    {
    Application("Visitors") = 0;
    }

    function Session_OnStart()
    {
    Application.Lock();
    {
    Application("Visitors") = Application("Visitors") + 1;
    }
    Application.Unlock();

    // remainder of this function omitted, as it is irrelevant
    

    }

    function Session_OnEnd()
    {
    Application.Lock();
    {
    iVisitors = Application("Visitors");
    if( iVisitors > 0 )
    {
    Application("Visitors") = iVisitors - 1;
    }
    else
    {
    Application("Visitors") = 0;
    }
    }
    Application.Unlock();
    }

    It appears to me that Session_OnEnd is never being called now, because Application("Visitors") keeps incrementing with each session BUT never deincrements since installing SP2! The code is so simple, that I can't see any reason why it is not doing so. Can anyone see a flaw in my code? Or am I just hosed? :(

    K G 2 Replies Last reply
    0
    • A achimera

      I have a classic ASP web site that has been running flawlessly for at least 6 years now. I updated Windows Server 2003 to SP2 a few days ago, and now a "session counter" that I had implemented in Global.asa no longer works. Here is the code. From Global.asa:

      function Application_OnStart()
      {
      Application("Visitors") = 0;
      }

      function Session_OnStart()
      {
      Application.Lock();
      {
      Application("Visitors") = Application("Visitors") + 1;
      }
      Application.Unlock();

      // remainder of this function omitted, as it is irrelevant
      

      }

      function Session_OnEnd()
      {
      Application.Lock();
      {
      iVisitors = Application("Visitors");
      if( iVisitors > 0 )
      {
      Application("Visitors") = iVisitors - 1;
      }
      else
      {
      Application("Visitors") = 0;
      }
      }
      Application.Unlock();
      }

      It appears to me that Session_OnEnd is never being called now, because Application("Visitors") keeps incrementing with each session BUT never deincrements since installing SP2! The code is so simple, that I can't see any reason why it is not doing so. Can anyone see a flaw in my code? Or am I just hosed? :(

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      There are certain session types that do not call Session end. Along with that the session doesn't end until it timesout. So if your session timeout has recently changed that could be the issue as well. Here is the MS help on it: The Session_OnEnd Event You can handle the Session_OnEnd event by adding a subroutine named Session_OnEnd to the Global.asax file. The Session_OnEnd subroutine is run when the Abandon method has been called or when the session has expired. A session expires when the number of minutes specified by the Timeout property passes without a request being made for the session. The Session_OnEnd event is supported only when the session state Mode property is set to InProc, which is the default. If the session state Mode is StateServer or SQLServer, then the Session_OnEnd event in the Global.asax file is ignored. If the session state Mode is set to Custom, then support for the Session_OnEnd event is determined by the custom session-state store provider. You can use the Session_OnEnd event to clean up session-related information such as information for a user that is tracked in a data source by the SessionID value. Hope that helps. Ben

      A 2 Replies Last reply
      0
      • K kubben

        There are certain session types that do not call Session end. Along with that the session doesn't end until it timesout. So if your session timeout has recently changed that could be the issue as well. Here is the MS help on it: The Session_OnEnd Event You can handle the Session_OnEnd event by adding a subroutine named Session_OnEnd to the Global.asax file. The Session_OnEnd subroutine is run when the Abandon method has been called or when the session has expired. A session expires when the number of minutes specified by the Timeout property passes without a request being made for the session. The Session_OnEnd event is supported only when the session state Mode property is set to InProc, which is the default. If the session state Mode is StateServer or SQLServer, then the Session_OnEnd event in the Global.asax file is ignored. If the session state Mode is set to Custom, then support for the Session_OnEnd event is determined by the custom session-state store provider. You can use the Session_OnEnd event to clean up session-related information such as information for a user that is tracked in a data source by the SessionID value. Hope that helps. Ben

        A Offline
        A Offline
        achimera
        wrote on last edited by
        #3

        Yeah, I'm aware how sessions work. Unfortunately, unless I'm mistaken, the MS Help information above applies only to the ASP.NET Global.asax... while I'm using the classic ASP Global.asa. Thanks for your help though. I do appreciate it. I'll try digging deeper.

        1 Reply Last reply
        0
        • K kubben

          There are certain session types that do not call Session end. Along with that the session doesn't end until it timesout. So if your session timeout has recently changed that could be the issue as well. Here is the MS help on it: The Session_OnEnd Event You can handle the Session_OnEnd event by adding a subroutine named Session_OnEnd to the Global.asax file. The Session_OnEnd subroutine is run when the Abandon method has been called or when the session has expired. A session expires when the number of minutes specified by the Timeout property passes without a request being made for the session. The Session_OnEnd event is supported only when the session state Mode property is set to InProc, which is the default. If the session state Mode is StateServer or SQLServer, then the Session_OnEnd event in the Global.asax file is ignored. If the session state Mode is set to Custom, then support for the Session_OnEnd event is determined by the custom session-state store provider. You can use the Session_OnEnd event to clean up session-related information such as information for a user that is tracked in a data source by the SessionID value. Hope that helps. Ben

          A Offline
          A Offline
          achimera
          wrote on last edited by
          #4

          I created a new blank web site that has ONLY the following 2 files in it: =========== DEFAULT.ASP ===========

          <html>
          <body>
          Sessions: <%= Application("Visitors") %>
          </body>
          </html>

          =========== GLOBAL.ASA ===========

          <SCRIPT LANGUAGE=JScript RUNAT=Server>
           
          function Application_OnStart()
          {
          Application("Visitors") = 0;
          }
           
          function Session_OnStart()
          {
          Application.Lock();
          {
          Application("Visitors") = Application("Visitors") + 1;
          }
          Application.Unlock();
          }
           
          function Session_OnEnd()
          {
          Application.Lock();
          {
          iVisitors = Application("Visitors");
          if( iVisitors > 0 )
          {
          Application("Visitors") = iVisitors - 1;
          }
          else
          {
          Application("Visitors") = 0;
          }
          }
          Application.Unlock();
          }
          </SCRIPT>

          ... and absolutely NOTHING else. I also adjusted the session length from 20 minutes to 2 minutes (for the purposes of testing). Same thing... the value of Application("Visitors") keeps incrementing with each new session, but NEVER deincrements. As mentioned, all of this has worked flawlessly for years upon years... but after installing SP2 to Windows Server 2003... all of a sudden it is broken. I don't see anyway to fix this. Which blows. Any ideas?

          1 Reply Last reply
          0
          • A achimera

            I have a classic ASP web site that has been running flawlessly for at least 6 years now. I updated Windows Server 2003 to SP2 a few days ago, and now a "session counter" that I had implemented in Global.asa no longer works. Here is the code. From Global.asa:

            function Application_OnStart()
            {
            Application("Visitors") = 0;
            }

            function Session_OnStart()
            {
            Application.Lock();
            {
            Application("Visitors") = Application("Visitors") + 1;
            }
            Application.Unlock();

            // remainder of this function omitted, as it is irrelevant
            

            }

            function Session_OnEnd()
            {
            Application.Lock();
            {
            iVisitors = Application("Visitors");
            if( iVisitors > 0 )
            {
            Application("Visitors") = iVisitors - 1;
            }
            else
            {
            Application("Visitors") = 0;
            }
            }
            Application.Unlock();
            }

            It appears to me that Session_OnEnd is never being called now, because Application("Visitors") keeps incrementing with each session BUT never deincrements since installing SP2! The code is so simple, that I can't see any reason why it is not doing so. Can anyone see a flaw in my code? Or am I just hosed? :(

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #5

            Try to put something in the session object: Session("Test") = 42 This will keep the session object alive. I think that it might be a change in how the server handles session objects. If they don't contain anything they are discarded immediately without triggering a Session_OnEnd. The session id is kept by the browser, so when the user returns a new session object with the same id will be created. As it's a recreated session object, it probably doesn't trigger a Session_OnStart.

            --- single minded; short sighted; long gone;

            A 1 Reply Last reply
            0
            • G Guffa

              Try to put something in the session object: Session("Test") = 42 This will keep the session object alive. I think that it might be a change in how the server handles session objects. If they don't contain anything they are discarded immediately without triggering a Session_OnEnd. The session id is kept by the browser, so when the user returns a new session object with the same id will be created. As it's a recreated session object, it probably doesn't trigger a Session_OnStart.

              --- single minded; short sighted; long gone;

              A Offline
              A Offline
              achimera
              wrote on last edited by
              #6

              Thanks, but it's not that. The original web site where I noticed this has thousands of users and uses session variables to track login information across pages.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups