Catching event when web form closes

A

AnHund

Hi

I'm trying to catch an event when a web form is closed (user presses X in
upper right corner of form), because I want to do som cleaning up before the
ending the session.

I tried overriding different event handlers like Dispose, OnAbortTransaction
and OnUnload but these handlers are not called.

Actually I thought that Session_End would be called when the form was closed.

Any ideas would be very much appreciated.

Thanks.

BR. AnHund

PS. Hope this is the correct discussion group - couldn't find a closer match.
 
K

Ken Cox [Microsoft MVP]

The closing of the Web form is only available as a client-side event. Due to
the disconnected nature of the browser, you can't really do much on the
server since the browser is "gone" from the scene and can no longer
postback.

You should be able to catch the Session_End but it may mean waiting for the
20 minute (default) timeout.

Not too satisfactory,eh.

Ken
 
A

AnHund

Well, actually I was debugging from VS .Net and i never got the Session_End
event - but of course Session_End was called when doing a real test.

That is ok for me - I don't have to get the event right away.

Thanks.

BR. AnHund
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,139
Messages
2,570,807
Members
47,356
Latest member
Tommyhotly

Latest Threads

Top