Alvin,
post a complete working example demonstrating the problem.
I will take a look at it.
That is very nice. However, I've been at it all day and I found what the
problem was.
After making a small project in Visual Studio I found that to work just
fine. Then it was a matter of finding the differences between my hand-made
project and the little thing that Visual Studio spit up. And there were a
lot of differences...
I finally discovered that my test code that was called from several
application events to help me see the sequence of events failed silently. It
messed with the User object and although I was being a good boy doing
if (User == null) ...
before accessing any members, this still was the code that broke it all.
User is not available at all times (since it is really
HttpContext.Current.User). After I started checking for null with
HttpContext.Current it was okay.
So these silent errors in one or more application events prevented ASP.NET
from finishing some sequence and setting some hooks, causing Session_End not
to be fired later on.
Now had I started doing my project from within Visual Studio from the start
I might have hit the error straight away in the debugger (or maybe not, I
don't know how and if the debugger hooks up with application events). It
doesn't seem too hard to wrap a Visual Studio project around my site, I will
probably do so soon now that I felt how much time I can spend finding
something silly as this.
Thanks for the insights. I did learn a lot in the process. I still feel
stupid though, now why would that be
.
Martin.