Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 17, 2009 01:03 PM by bala.vanchi
Mar 24, 2008 08:16 PM|LINK
In my web application, I need to do certain things like clearing the session when the user clicks on close button in browser.
Is there any event. dont tell me unload event, because this will be triggered each time of post back. I want a event that will be triggered only when user clicks on close button?
Also, can we prevent the same form to be opened twice?
Thanks in Advance
Mar 24, 2008 09:01 PM|LINK
Off hand I think you would have to write an event to capture the close button being pushed, then inside there you could do Session.Clear().
Not quite sure about this one......are you talking about the X close button OR your own custom button?
Mar 24, 2008 09:12 PM|LINK
why not handling that in your global.asax session_end event where you can clear out your session.
Mar 24, 2008 09:20 PM|LINK
I believe you have 2 write client side code for the window.onbeforeunload event. But I don't know what to exactly write in there...
EDIT: I mean you have to write code to call some server side function which call a Session.Clear or the like, but I don't know how to write so...
Mar 26, 2008 04:01 AM|LINK
Hi Shobana P.S ,
You can open a new page when user close a page window.
Then you can clear the session, and close the window, do't send html to user.
Let me know if I have misunderstood what you mean.
Hope it helps,
Mar 10, 2009 10:21 AM|LINK
but in case i dont want to do this on refresh then what to do ?
Because unload event will fire in both case
Apr 17, 2009 01:03 PM|LINK
What if user opened it in multiple window and try close the any one of the window?