Logoff User when browser tab page is closed, ASP.NET MVC
asp.net, asp.net-mvc
Solution
We decided to use cookie less authentication so that the authentication token is part of the url. When the tab is closed and they open the website again, they will be asked to authenticate again :)
Problem
In one of the ASP.NET MVC apps we would like to logoff the user automatically if he closes the browser tab in which the app is opened. We are using the following code when he authenticates. FormsAuthentication.SetAuthCookie(userName, false) As of now, if we closes the browser window and relaunch it, users are asked to authenticate again. But we want to ask users to authenticate again if they close the tab and try to access any of the website urls.