Search code examples
asp.net-mvcasp.net-coreasp.net-identity

Don't see the Register and Login links after scaffolding Identity pages to an ASP .NET Core 6.0 MVC project


I am working on an Asp.Net Core 6.0 MVC project. I have scaffolded the Identity razor pages. I see all the razor pages being added correctly, including Register.chtml and Login.cshtml pages. The Program.cs file was also updated with the following lines

    builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
            .AddEntityFrameworkStores<DbContext>();
        var app = builder.Build();

app.UseRouting();
    app.UseAuthentication(); 

    app.UseAuthorization();

    app.MapControllerRoute(
            name: "default",
            pattern: "{controller=Home}/{action=Index}/{id?}");

When I run the application, I don't see the Register and Login links on the page. When I checked the Chrome Dev Tools, I don't see any JavaScript errors.


Solution

  • Somehow this line was missing in the Program.cs file. Once, I added it, then I was able to see the Register and Login links

    app.MapRazorPages();