title: How to set default identity login page in .net core 6 mvc instead of index page in program.cs
body: <p>I am developing web app with .net core 6. How can I set default page to Identity Login page instead of index page in program.cs. Below is my program.cs code</p>
  <pre><code>using Microsoft.EntityFrameworkCore;
  using ASPNETCOREPRJ.Areas.Identity.Data;
  using ASPNETCOREPRJ.Data;
  
  var builder = WebApplication.CreateBuilder(args);
  var connectionString = builder.Configuration.GetConnectionString(&quot;DBContextConnection&quot;);builder.Services.AddDbContext&lt;DBContext&gt;(options =&gt;
      options.UseSqlServer(connectionString));builder.Services.AddDefaultIdentity&lt;ApplicationUser&gt;(options =&gt; options.SignIn.RequireConfirmedAccount = false)
  
      .AddRoles&lt;IdentityRole&gt;()
      .AddEntityFrameworkStores&lt;DBContext&gt;();
  // Add services to the container.
  builder.Services.AddRazorPages();
  builder.Services.AddControllersWithViews();
  
  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.MapControllerRoute(name: &quot;default&quot;,
      pattern: &quot;{controller=Home}/{action=Index}/{id?}&quot;);
  app.MapRazorPages(); 
  
  app.Run();```
  </code></pre>