Pierke,
The Session_End handler is the appropriate place to handle this sort of
action. However, this handler is only called when you a) explicitly close the
session in your code (e.g. in response to a user "log out" action which you
define), or b) when the session times out.
Note that if the client browser is simply closed without giving you the
opportunity to programmatically close the session, your Session_End handler
will not fire until the session times out. This is probably why you are not
seeing this event fire.
The timeout for the session can be modified in the web.config <sessionState>
tag timeout attribute (which is given in minutes), eg:
<configuration>
<system.web>
<sessionState mode="InProc" timeout="20" />
</system.web>
</configuration>
However it is not recommended to set this timeout too small (except when
testing your session end handler, where you could set it down to just 1
minute so you dont have to wait too long for it to fire when debugging) as
the session may start timing out whilst the user is still reading / working
on a single page.
Hope this helps,
Chris.
"Pierke" wrote:
Hey guys out there,
I really need your help, i am building up a web site, so
for security reasons i need to do "some things" before the
user log off, and i indeed do it. Now the matter is that
any user can also CLOSE the page without logging off, and
by then i would need to be able to so "some things" (such
as save his log off time) and i need to do it before the
application get close, i have tried a hundred times to put
some code on the Global.asax file in the procedure
application_end or session_end, but it is like it never
passes through this peace of code. So, can you tell me
where to put the code i want to execute in the very moment
in which the application start closing? Thanks in
advantage,
Pierke