title: Increasing login timeout
body: <p>I created a new ASP.NET MVC website using ASP.NET Identity. I'm using the standard logic generated by Visual Studio 2017, and I selected <em>Individual User Accounts</em>.</p>
  
  <p>Everything works fine except that it seems to log me out within about 10 - 20 minutes of inactivity, and I'd like to stay logged in for longer than that.</p>
  
  <p>After Googling around, I found information about setting <code>CookieAuthenticationOptions.ExpireTimeSpan</code>. However, using the debugger, I can see that this value is set to 14 days by default.</p>
  
  <p><strong>Startup.Auth.cs:</strong></p>
  
  <pre><code>app.UseCookieAuthentication(new CookieAuthenticationOptions
  {
      AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
      LoginPath = new PathString("/Account/Login"),
      Provider = new CookieAuthenticationProvider
      {
          OnValidateIdentity = SecurityStampValidator.OnValidateIdentity&lt;ApplicationUserManager, ApplicationUser&gt;(
              validateInterval: TimeSpan.FromMinutes(30),
              regenerateIdentity: (manager, user) =&gt; user.GenerateUserIdentityAsync(manager))
      },
      //SlidingExpiration = true,               // Default: true
      //ExpireTimeSpan = TimeSpan.FromHours(1)  // Default: 14 days
  });
  </code></pre>
  
  <p><strong>Web.Config:</strong></p>
  
  <pre><code>&lt;system.web&gt;
    &lt;authentication mode="None" /&gt;
    &lt;compilation debug="true" targetFramework="4.6" /&gt;
    &lt;httpRuntime targetFramework="4.5.2" executionTimeout="240" maxRequestLength="20480" /&gt;
    &lt;httpModules&gt;
      &lt;add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" /&gt;
    &lt;/httpModules&gt;
    &lt;customErrors mode="Off"&gt;&lt;/customErrors&gt;
  &lt;/system.web&gt;
  &lt;system.webServer&gt;
    &lt;modules&gt;
      &lt;remove name="FormsAuthentication" /&gt;
      &lt;remove name="ApplicationInsightsWebTracking" /&gt;
      &lt;add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" /&gt;
    &lt;/modules&gt;
    &lt;validation validateIntegratedModeConfiguration="false" /&gt;
  &lt;security&gt;
    &lt;requestFiltering&gt;
        &lt;requestLimits maxAllowedContentLength="20971520" /&gt;
      &lt;/requestFiltering&gt;
    &lt;/security&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>So, does anyone know how to increase the amount of time before I get logged out due to inactivity?</p>