title: My user isn't logged out after the session expires using asp.net identity 2.0
body: <p>I have a MVC application using Identity 2 for authentication. After I log in, if I close the browser and then open the application again, there are 3 problems occurring.</p>
  
  <ol>
  <li>The user isn't redirected to the login page</li>
  <li>The session still contains some of the user details in the claim</li>
  <li>The session is missing other custom information from the claim that is not part of the identity framework</li>
  </ol>
  
  <p>I am using IIS to run the application on a Windows Server, but I can reproduce the issue on my local dev environment</p>
  
  <p>Both the session in the cookie and on the server are set to expire after 1 minute while I am debugging the issue</p>
  
  <p><a href="https://i.stack.imgur.com/Nh2f4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nh2f4.jpg" alt="enter image description here"></a></p>
  
  <pre><code>app.UseCookieAuthentication(new CookieAuthenticationOptions
              {
                  AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                  LoginPath = new PathString(url.Action("LogIn","Auth")),
                  Provider = new CookieAuthenticationProvider
                  {
                      // Enables the application to validate the security stamp when the user logs in.
                      // This is a security feature which is used when you change a password or add an external login to your account.  
                      OnValidateIdentity = SecurityStampValidator.OnValidateIdentity&lt;ApplicationUserManager, User&gt;(
                          validateInterval: TimeSpan.FromMinutes(1),
                          regenerateIdentity: (manager, user) =&gt; user.GenerateUserIdentityAsync(manager))
                  },
                  CookieName = "MyApplication"
              });
  </code></pre>