"Dan Aldean" <do*******@rogers.comwrote in message
news:eJ**************@TK2MSFTNGP04.phx.gbl...
I have an application that needs to save some info in the database when
the user closes the application by clicking the x box in the right top
corner of the window.
Ah yes - this one comes up fairly regularly...
I tried the session_end event in the global module but it only fires with
the timeout, not when the app is closed.
That's right - the server has no knowledge whatever of what is happening in
the browser until / unless the browser sends it another HttpRequest, due to
the disconnected architecture of the web. This is a common misconception...
Application_end doesn't work either.
Indeed not - Application_End fires when the final live session is torn down,
either through code or through automatic timeout.
I use InProc in web.config.
Irrelevant...
Your only option is to try to use the client-side window.onunload event:
http://www.google.co.uk/search?sourc...ow%2eunload%22
However, be aware that this is not guaranteed to work the same way for all
browsers across all platforms, and will almost certainly also fire if the
user refreshes the page...