What The Event For When I Close The X Button Of The Windows In Asp.net?

November 7th, 2009 by CTO WebOjO.com website designers Lahore Pakistan Leave a reply »

if one user close the windows throw X button of the windows, I need one event to do an action (delete the user for example) how I can do it. asp.net(code behind vb.net) bring a solution

Advertisement

2 comments

  1. rod says:

    Try the page_unload event

  2. Smutty says:

    You have to distinguish between client side events and server side events.
    When the browser is closed, the server is unaware of this event. It is strictly a client side event. Keep in mind that HTTP is a stateless protocol.
    There is something however you can do. You can write code in the Session_End() function in the global.asax file. The code will run when the session for a user times out.
    void Session_End(object sender, EventArgs e) {
    // write code
    }