title: ASP.NET Core 6 Authentication via Azure AD: customize login path
body: <p>I'm working on a POC to create an Asp.Net Core 6 Web App with the ability to authenticate users via an Azure AD identity server AND via a custom local user DB.</p>
  <p>I need to create a Login page where the user can choose between the two authentication methods ('/Login/Login').</p>
  <p>When I try to load a not-anonymous page (controller/action) the system redirect me automatically to the Microsoft login page instead of my custom page (/Login/Login).</p>
  <p>I have tried some solutions like:</p>
  <pre><code>builder.Services
  .AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
  .AddMicrosoftIdentityWebApp(options =&gt; {...}, configureCookieAuthenticationOptions: options =&gt;
  {
      options.LoginPath = new PathString(&quot;/Login/Login&quot;);
  })
  .EnableTokenAcquisitionToCallDownstreamApi(new[] { &quot;user.read&quot; })
  .AddInMemoryTokenCaches();
  </code></pre>
  <p>or</p>
  <pre><code>    builder.Services.ConfigureApplicationCookie(options =&gt; {
          options.LoginPath = new PathString(&quot;/Login/Login&quot;);
      });
  </code></pre>
  <p>But nothing seems to work.</p>
  <p>Any suggestions?</p>
  <p>Thank you!</p>