简体   繁体   English

ASP.NET Core 6 使用默认身份页面而不是现有身份页面

[英]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.我有一个带有自定义登录和注册页面的 .NET Core 5 web 应用程序,最近我将框架更新为 .NET 6 并且没有更改代码。 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这是我目前在 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].在Visual Studio中,右击“Solution Explorer”中的任意位置,然后“Add>New Scaffolded Item”,在弹出菜单select“Identity”中,它会显示一个带有复选框的对话框,勾选你想要覆盖的视图(例如Account\Login, Account\Register)和select你的数据上下文class,然后点击【添加】。

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.您选择的视图将添加到您的解决方案下的 Areas\Identity\Pages...(例如 Areas\Identity\Pages\Account\Login.cshtml),您现在可以使用您拥有的旧视图覆盖它。

see Scaffold Identity in ASP.NET Core projects参见ASP.NET Core 项目中的 Scaffold Identity

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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