title: ASP.NET Identity regenerats Identity at each request
body: <p>I have an ASP.NET MVC application and I'm using ASP.NET Identity 2. I have a weird problem. <code>ApplicationUser.GenerateUserIdentityAsync</code> is getting called for each request browser makes to my website. I've added some <code>Trace.WriteLine</code> and this is the result after removing IIS output:</p>
  
  <pre><code>IdentityConfig.Configuration called
  ApplicationUser.GenerateUserIdentityAsync called url: http://localhost:54294/
  ApplicationUser.GenerateUserIdentityAsync called url: http://localhost:54294/Content/bootstrap.css
  ApplicationUser.GenerateUserIdentityAsync called url: http://localhost:54294/Scripts/modernizr-2.8.3.js
  ApplicationUser.GenerateUserIdentityAsync called url: http://localhost:54294/Content/site.css
  ApplicationUser.GenerateUserIdentityAsync called url: http://localhost:54294/Scripts/jquery-2.1.3.js
  ApplicationUser.GenerateUserIdentityAsync called url: http://localhost:54294/Scripts/bootstrap.js
  ApplicationUser.GenerateUserIdentityAsync called url: http://localhost:54294/Scripts/respond.js
  ApplicationUser.GenerateUserIdentityAsync called url: http://localhost:54294/Scripts/script.js
  ApplicationUser.GenerateUserIdentityAsync called url: http://localhost:54294/Glimpse.axd?n=glimpse_client&amp;hash=8913cd7e
  ApplicationUser.GenerateUserIdentityAsync called url: http://localhost:54294/Glimpse.axd?n=glimpse_metadata&amp;hash=8913cd7e&amp;callback=glimpse.data.initMetadata
  ApplicationUser.GenerateUserIdentityAsync called url: http://localhost:54294/Glimpse.axd?n=glimpse_request&amp;requestId=6171c2b0-b6e5-4495-b495-4fdaddbe6e8f&amp;hash=8913cd7e&amp;callback=glimpse.data.initData
  ApplicationUser.GenerateUserIdentityAsync called url: http://localhost:54294/Glimpse.axd?n=glimpse_sprite&amp;hash=8913cd7e
  ApplicationUser.GenerateUserIdentityAsync called url: http://localhost:54294/__browserLink/requestData/38254292a54f4595ad26158540adbb6a?version=2
  </code></pre>
  
  <p>while if I run a default MVC Application created by template, I'm getting this:</p>
  
  <pre><code>IdentityConfig.Configuration called
  </code></pre>
  
  <p>and only if I login, It'll call <code>ApplicationUser.GenerateUserIdentityAsync</code>.</p>
  
  <p>I've looked everywhere I thought it might be but I didn't find any result. I'm using (if it helps)</p>
  
  <pre><code>StructureMap 3
  Elmah
  Glimpse
  ASP.NET MVC 5
  EF6
  ASP.NET Identity 2
  </code></pre>
  
  <p><strong>Additional Info</strong></p>
  
  <p>I'm adding users directly into database without using a UserManage. I'm not sure if it makes any problems with Identity or not.</p>
  
  <hr>
  
  <p><strong>Update</strong></p>
  
  <p>I've dropped database and it didn't happen anymore. What is happening?</p>
  
  <p><strong>Update 2</strong></p>
  
  <p>It happened in my Google Chrome (I monitor SQL connections using glimpse) and after removing stored cookies, It didn't happen. Can logging in in other browsers cause this problem?</p>
  
  <p><strong>Update 3</strong></p>
  
  <p>Also log off - log in seems to solve the problem temporary.</p>