How to trap the click event of the browser window's "x" button?

G

Guest

Hi,

In our ASP.Net app, we need to do some backend house keeping job when a user
is about to end his/her session. We do have an "Logoff" button designed for
this purpose and we have been telling our client to always exit using this
button. When they exit this way, our server logic will make contact with the
backend and clean things up before the session goes out.

Our problem is, however, that since people are so used to clicking on the
"x" button on the upper right corner of the browser window and exit, we are
facing the problem of hanging backend processes all the time.

What I think we need is somehow capter the click event of the "x" button and
invoke the some logic that our "Logoff" button does. But this doesn't seem to
be an easy thing to do. Can someone shed some light on this one in terms of
how we should approach this? Some example would be even better.

Thanks a lot!

Feng
 

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

Top