Is there an event like onLoad?
just at closing the Site (onClose)?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not in the sense that I suspect you’re thinking. All your code in ASP.net runs on the server which doesn’t inherently ‘know’ when the site is closed by the user. To achieve what you’re after, you’d need to use Javascript to handle the window.onunload / window.onbeforeunload events and trigger some form of request to the server.
Take a look at http://developer.mozilla.org/en/DOM/window.onunload for more information on the window.onunload event.
Update: If you’re using/able to use ASP.net AJAX, there’s some quite tidy wrappers there that provide you with a similar set of events/beahviours to the server-side page lifecycle. There’s a pretty decent tutorial from Stephen Walther on his blog.