title: ASP.NET Core 6.0 Web Application not redirecting to identity server on authorization
body: <p>Setting up a simple testproject for MVC application with OpenIDConnect using IdentityServer4.</p>
  <p>The Privacy view is set up with [Authorize], but when I try to navigate to it, it tries to redirect to the ASP.NET Identity page  /Account/Login (which does not exist in the web app). It should redirect to the IdentityServer 4 project.</p>
  <p>Program.cs</p>
  <pre><code>using Microsoft.AspNetCore.Authentication.Cookies;
  using Microsoft.AspNetCore.Authentication.OpenIdConnect;
  
  var builder = WebApplication.CreateBuilder(args);
  
  // Add services to the container.
  builder.Services.AddControllersWithViews();
  builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
    .AddCookie()
    .AddOpenIdConnect(OpenIdConnectDefaults.AuthenticationScheme,
    options =&gt;
    {
      options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
      options.Authority = &quot;https://localhost:5001&quot;;
      options.ClientId = &quot;testapplication&quot;;
      options.ClientSecret = &quot;test&quot;;
      options.ResponseType = &quot;code&quot;;
      options.Scope.Add(&quot;openid&quot;);
      //options.ResponseMode = &quot;form_post&quot;;
      options.SaveTokens = true;
      options.UsePkce = true;
    });
  
  var app = builder.Build();
  
  // Configure the HTTP request pipeline.
  if (!app.Environment.IsDevelopment())
  {
    app.UseExceptionHandler(&quot;/Home/Error&quot;);
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
  }
  
  app.UseHttpsRedirection();
  app.UseStaticFiles();
  
  app.UseRouting();
  
  app.UseAuthentication();
  app.UseAuthorization();
  
  app.UseEndpoints(endpoints =&gt;
   {
     endpoints.MapControllers();
  
   });
  
  app.MapControllerRoute(
      name: &quot;default&quot;,
      pattern: &quot;{controller=Home}/{action=Index}/{id?}&quot;);
  
  app.Run();
  </code></pre>
  <p>It should redirect to https://localhost:5001 (which is where the Identity Server is running), but it does not.</p>
  <p><a href="https://i.stack.imgur.com/JAOfj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JAOfj.png" alt="enter image description here" /></a></p>
  <p>This is a Core 6.0 project, so there might be something which I am missing as I've used Core 3.1 examples.</p>