How can I update a record in the database with information about the logged user when they close the browser? It's crucial that this record gets updated whenever the user logs out or closes the browser. While I can handle the update on the server-side event when the user clicks 'Logout,' what should be done if the user simply exits the browser?
One suggestion is to use the window.onbeforeunload event and make an asynchronous call to a Web Service (WS) or WebMethod. However, I am not convinced because using onbeforeunload displays a confirmation prompt. Is there a way to avoid this message and directly invoke the method?
I am exploring if there is a 'server-side' solution without relying on AJAX or JavaScript. Could there be a method to trigger an event upon session abandonment or clearance, or any other approach to solve this issue while only working on the code-behind?