I need the user to close the browser or the page tab, update the Logged status that is in the database (for user access control).
To do this use the following
Method JavaScript
:
window.onbeforeunload = function (event) {
PageMethods.LogOut();
}
And the following WebMethod
:
[System.Web.Services.WebMethod]
public static void LogOut()
{
//Atualiza status do usuário
}
The problem is that this method is called at all times, when I change pages, when I refresh the page ( F5 ), how do I solve this?