How do I log a user out when they close their browser or tab in ASP.NET MVC?

There are a few things you can do to make sure the user is signed out when the browser is closed, but it depends on how you’re setting the FormsAuthentication cookie: Use Cookieless=True. Set a FormsAuthenticationTicket to not be persistent Use FormsAuthentication.SetAuthCookie to set Persistence to false Use a JavaScript approach to remove the cookie … Read more