0

In ASP.Net Web application i have to logout after browser is closed directly(All browsers like google chrome,IE and Firefox).Please suggest me any idea.

1 Answers1

0

Just giving an idea

If you will add an event listener to the window for example unload it will fire for page reloads also. Try doing this and see if it is a good idea.

<body onUnload="signOut()">

Make signOut() function redirect to Account/LogOff which is a built in method of ASP.net.

 function signOut() {
    $.ajax({
        url: "/Account/LogOff",
        success: function (result) {
        // success
        }
    });
 }

Now, when the tab or browser is closed, it will redirect to LogOff method and user will have to login again.

Mohammad Basit
  • 971
  • 6
  • 18