ASP.Net Core 2.1< - 自定义 AccountController 中的身份
Identity in ASP.Net Core 2.1< - Customize AccountController
我已经安装了 ASP.NET Core 2.1
但即使我使用 ASP.NET Core 2.1
和 Individual User Accounts
创建了一个新的 ASP.NET Core Web Application
→ Store user accounts in-app
我找不到帐户控制器或视图。
我仍然可以毫无问题地注册和登录,但我找不到它的代码,它存在于 2.0 中。
changes in 2.1 was Razor Class Libraries and the default identity lives in one of these in the individual auth templates. If you would like to have the code in your app so you can customise it, you can scaffold it out with Visual Studio, or with the global scaffolder tool. See this guide 两者之一。
原来 ASP.NET Core Identity
现在可以作为名为 Microsoft.AspNetCore.Identity.UI
的预构建包使用。
您可以在此处阅读更多相关信息:
https://blogs.msdn.microsoft.com/webdev/2018/03/02/aspnetcore-2-1-identity-ui/
自 ASP.NET Core 2.1
以来 identity UI is shipped as a library。
但是您可以通过将视图和控制器放在正确的位置来覆盖它们(例如 View/Account/Login.cshtml)。
ASP.NET Core 2.1 引入了名为 Razor class 库的新功能,可让您将视图和页面构建为可重用库的一部分。 ASP.NET 核心标识已移至此类 RCL。您可以在您的项目中覆盖它:
- 从 Solution Explorer,右键单击项目 > Add > New Scaffolded Item.
- 从 Add Scaffold 对话框的左侧窗格中,select Identity > ADD.
- 在 ADD Identity 对话框中,选择您要覆盖的文件。
- Select 必要时布局
- Select 或创建 数据上下文 class.
- 点击添加。
更多信息visit documentation。
我的解决方案是用.net core 2.0创建项目,然后将框架更新到2.1,所有依赖更新到最新版本
据我所知,AccountController 代码已移至 Razor 页面(及其背后的代码)并且使用默认值效果最佳,因此可以自定义代码脚手架(即在正确的位置创建文件)从一个全新的 Net Core 2.1 项目中右键单击 Visual Studio 2017 中的项目并选择添加 => 新脚手架项目 => 身份,这将打开一个 Select 对话框。选择所需的页面,然后就可以了。只需更改您想要的页面并复制到启用身份的项目中的相同位置,因为这些新页面会自动覆盖默认页面。这是使用 Identity 自定义 authentication/authorization 的新方法不确定是否有很多人认为这一重大进步!
我已经安装了 ASP.NET Core 2.1
但即使我使用 ASP.NET Core 2.1
和 Individual User Accounts
创建了一个新的 ASP.NET Core Web Application
→ Store user accounts in-app
我找不到帐户控制器或视图。
我仍然可以毫无问题地注册和登录,但我找不到它的代码,它存在于 2.0 中。
changes in 2.1 was Razor Class Libraries and the default identity lives in one of these in the individual auth templates. If you would like to have the code in your app so you can customise it, you can scaffold it out with Visual Studio, or with the global scaffolder tool. See this guide 两者之一。
原来 ASP.NET Core Identity
现在可以作为名为 Microsoft.AspNetCore.Identity.UI
的预构建包使用。
您可以在此处阅读更多相关信息:
https://blogs.msdn.microsoft.com/webdev/2018/03/02/aspnetcore-2-1-identity-ui/
自 ASP.NET Core 2.1
以来 identity UI is shipped as a library。
但是您可以通过将视图和控制器放在正确的位置来覆盖它们(例如 View/Account/Login.cshtml)。
ASP.NET Core 2.1 引入了名为 Razor class 库的新功能,可让您将视图和页面构建为可重用库的一部分。 ASP.NET 核心标识已移至此类 RCL。您可以在您的项目中覆盖它:
- 从 Solution Explorer,右键单击项目 > Add > New Scaffolded Item.
- 从 Add Scaffold 对话框的左侧窗格中,select Identity > ADD.
- 在 ADD Identity 对话框中,选择您要覆盖的文件。
- Select 必要时布局
- Select 或创建 数据上下文 class.
- 点击添加。
更多信息visit documentation。
我的解决方案是用.net core 2.0创建项目,然后将框架更新到2.1,所有依赖更新到最新版本
据我所知,AccountController 代码已移至 Razor 页面(及其背后的代码)并且使用默认值效果最佳,因此可以自定义代码脚手架(即在正确的位置创建文件)从一个全新的 Net Core 2.1 项目中右键单击 Visual Studio 2017 中的项目并选择添加 => 新脚手架项目 => 身份,这将打开一个 Select 对话框。选择所需的页面,然后就可以了。只需更改您想要的页面并复制到启用身份的项目中的相同位置,因为这些新页面会自动覆盖默认页面。这是使用 Identity 自定义 authentication/authorization 的新方法不确定是否有很多人认为这一重大进步!