简体   繁体   中英

ASP.NET Core 6 uses default identity pages instead existing ones

I have a .NET Core 5 web application with customized login and register pages, recently I updated the framework to .NET 6 and did no changes in code. It loads it's default Identity pages instead of existing ones. I don't want to load default identity pages and I want to use my existing pages. what's the problem. Here is my current rout in Startup.cs

services.AddRazorPages().AddRazorPagesOptions(options => {
    options.Conventions.AuthorizeAreaFolder("Admin", "/");
    options.Conventions.AuthorizeAreaFolder("User", "/");
    options.Conventions.AuthorizeAreaPage("Identity", "/account/register");
    options.Conventions.AuthorizeAreaPage("Id", "/account/register");
});

In Visual Studio, right click anywhere in "Solution Explorer", then "Add>New Scaffolded Item", in the pop-up menu select "Identity", it will show a dialog with checkboxes, check the views you want to override (eg Account\Login, Account\Register), and select your data context class, then click [Add].

The views you've selected will be added to your solution under Areas\Identity\Pages... (eg Areas\Identity\Pages\Account\Login.cshtml), you may now override it with the old view you have.

see Scaffold Identity in ASP.NET Core projects

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM