title: .net core Authentication with identity doesn't run my action
body: <p>I am trying to use Cookie authentication in my .net core MVC project. The process is that After Registration I have an entry in the ASPNetUsers table and I have extended this table to include a userType. After the user has logged in I can see that there is a cookie in the cookies collection through the chrome browser. When I try to redirect the user after login it fails. If I adorn the method I'm redirecting with    <code>[AllowAnonymous]</code> the method gets hit, so I know the redirect is correct.</p>
  
  <p>At the top of my controller I have    <code>[Authorize(ActiveAuthenticationSchemes = "Cookie")]</code></p>
  
  <p>When I start the application I register Identity with the following bit of code:</p>
  
  <pre><code> services.AddIdentity&lt;ApplicationUser, IdentityRole&lt;int&gt;&gt;(
              config =&gt; { config.User.RequireUniqueEmail = true;
                  config.Cookies.ApplicationCookie.LoginPath = "/Account/Login";
                  config.Cookies.ApplicationCookie.Events = new CookieAuthenticationEvents()
                  {
                      OnRedirectToLogin = async ctx =&gt;
                      {
                          if (ctx.Request.Path.StartsWithSegments("/visualjobs") &amp;&amp; ctx.Response.StatusCode == 200)
                          {
                              ctx.Response.StatusCode = 401;
                          }
                          else
                          {
                              ctx.Response.Redirect(ctx.RedirectUri);
                          }
                          await Task.Yield();
                      }
                  };
              }).AddEntityFrameworkStores&lt;VisualJobsDbContext, int&gt;()
            .AddDefaultTokenProviders();
  </code></pre>
  
  <p>and in the configuration of start up I have:</p>
  
  <pre><code> app.UseIdentity();
  
          app.UseCookieAuthentication(new CookieAuthenticationOptions()
          {
              AuthenticationScheme = "Cookie",
             // LoginPath = new PathString("/Account/Login/"),
              AutomaticAuthenticate = false
          });
  </code></pre>
  
  <p>What have I missed?</p>