I was looking for an event that would fire or a way to tell if the user was leaving a page. Either to navigate to another page or closing the page alltogether. Is this possible through the events that fire?
Share
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 ASP.NET per se.
You will have to write some front-end javascript to do this using something like
window.onbeforeunload(). Then you’d have to make an AJAX call to tell your back-end that this event is happening. This isn’t foolproof, of course. A browser crash or a forced “quit” would not fire this event.