title: .net Core how to use User.Identity.IsAuthenticated
body: <p>I step by step with MSDB to creating an authentication cookie</p>
  
  <p>step 1. setting start.cs</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
              .AddCookie(options =&gt;
              {
                 CookieAuthenticationDefaults.AuthenticationScheme;
  
              );
              services.AddDbContext&lt;CoreContext&gt;(options =&gt;
                    options.UseSqlServer(Configuration.GetConnectionString("DB")));
  
              services.AddMvc();
  }
  </code></pre>
  
  <p>step 2. add claims to ClaimsIdentity()</p>
  
  <pre><code> var claims = new List&lt;Claim&gt;
                  {
                  new Claim(ClaimTypes.MobilePhone, ""),
                  new Claim(ClaimTypes.Name, "")
                  };
   var userIdentity = new ClaimsIdentity("Custom");
   userIdentity.AddClaims(claims);
   ClaimsPrincipal userPrincipal = new ClaimsPrincipal(userIdentity);
   HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, userPrincipal);
  </code></pre>
  
  <p>last step on other action to get <code>User.Identity.IsAuthenticated</code> state</p>
  
  <p>but state always false how to fix problem?</p>
  
  <p><a href="https://github.com/hauserJr/CoreTemp/tree/master/CoreTemp_Alpha" rel="nofollow noreferrer">This is my source code</a></p>