I have one trouble that consist that when I'm using OWIN authentication and makes log in done and the browser or tab browser is closed, the session is still alive !!
There is a way to kill the session in the global asax file ?? Like session end method ??
When I'm make log off on my application I call an acction that contains the follow code:
[CustomValidateAntiForgeryToken]
public ActionResult LogOff()
{
var authenticationManager = HttpContext.GetOwinContext().Authentication;
authenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
SqlConnectionManager.Instance = null;
Session.Clear();
Session.Abandon();
Session.RemoveAll();
return RedirectToAction("Index", "Account", new {area = string.Empty});
}
But I would like to know how execute that code when the browser or tab browser is closed .. Thanks ...