title: ASP.NET Core Scoped User instance
body: <p>I create a scoped instance for my API.
  In the authentication and authorization parts I identify and set the userInfo (the information are coming from the sent API-Key and database behind...)</p>
  
  <p>For the Auth part is seems to be working fine. But when the requested Controlled is at row I get a new instance, see log:</p>
  
  <pre><code>11 PostEntry; Username: guest; Session-ID: ca6f6b4d-dc4a-41d5-9ac7-d85c5215255d
  10 Error-Controller-Constructor; Username: guest; Session-ID: ca6f6b4d-dc4a-41d5-9ac7-d85c5215255d
   9 AuthorizeAsync; Username: testuser; Session-ID: b7024903-26f5-47ee-bfc0-7b7a52adec71
   8 Username: testuser; ID: b7024903-26f5-47ee-bfc0-7b7a52adec71
   7 Return
   6 Start; Parameter[apiKey: 0330B900-0420-1337-ADCB-2DC70A89EEE3
   5 HandleAuthenticateAsync; Username: guest; Session-ID: b7024903-26f5-47ee-bfc0-7b7a52adec71
   4 Start; Username: guest; ID: b7024903-26f5-47ee-bfc0-7b7a52adec71
   3 AuthorizationService-Constructor; Username: guest; Session-ID: b7024903-26f5-47ee-bfc0-7b7a52adec71
   2 ApiKeyAuthenticationHandler; Username: guest; Session-ID: b7024903-26f5-47ee-bfc0-7b7a52adec71
   1 Username: guest; Session-ID: b7024903-26f5-47ee-bfc0-7b7a52adec71
  </code></pre>
  
  <p>From line 9 to 7 the userInfo object is set to the corresponding data. But when the controller is at row (line 11/10) there is a new instance, which can be seen by the new Session-ID. The session ID is set in the constructor of the object (<code>Guid.New()</code>).</p>
  
  <p>Starup:</p>
  
  <pre><code>services.AddScoped&lt;Identity.IUserInfo, Identity.UserInfo&gt;();
  </code></pre>
  
  <p>Kind Regards</p>