I continually get questions concerning the Application_OnEnd
and Session_OnEnd event handlers in global.asa not running.
The problem is usually not that the server isn't set up right
or that it's broken. It's usually something much simpler.
What developers tend to forget that the OnEnd events have no
way to tell you when something's wrong. This is understandable
since all the other pages on a web site and even the
Application_OnStart and Session_OnStart don't have this problem.
It stems from the fact that the OnEnd events execute long
after the user has
left so there's no browser to send an error message to.
As a result, you might never know there's a problem with your
code and the smallest bug or typo can cause the whole
routine to not execute at all.
Because of this, you really need to be extra careful when writing
or modifying code for these particular subroutines. I
recommend adding a set of code with noticable results at the
end of the routine during testing. For live code, some decent
error handling will help catch those run time errors that
seem to "just happen" on their own.