ASP.NET Core-类似于MVC的脚手架标识 [英] ASP.NET Core - Scaffold Identity like MVC

查看:116
本文介绍了ASP.NET Core-类似于MVC的脚手架标识的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个具有个人用户帐户"身份验证的Web应用程序MVC项目.

I have created a Web Application MVC project with Individuals User Accounts authentication.

之后,我创建了一个自定义UserIdentity.我试图更改身份"的默认注册"视图,以添加新字段,但是我只能将新页面作为剃刀页面"设置为脚手架.

Afterwards I created a custom UserIdentity. I am trying to change the default "Register" view of Identity adding my new fields, however I only managed to scaffold new pages as Razor Pages.

我的问题是:是否可以像MVC这样的结构支持这些新视图?我根本不想将MVC与Razor Pages混在一起.

My question is: Is it possible to scaffold these new views in some structure like MVC? I would not like to mix MVC with Razor Pages at all.

如果这不可能,是否有任何方法可以创建一个覆盖默认行为(例如,身份/帐户/注册)的控制器?

If this is not possible, is there any way to creating a controller that overrides the default behavior (Identity/Account/Register for example)?

推荐答案

对于希望在MVC上支持"身份的任何人,我建议采用以下方法:

For anyone that wants to "scaffold" identity on MVC, I recommend the following approach:

转到官方身份ASP.net Github存储库( https://github.com/aspnet/Identity)并下载.打开解决方案并搜索IdentitySample.Mvc项目.将必要的文件复制到您的项目中.

Go to the official identity ASP.net Github Repository (https://github.com/aspnet/Identity) and download it. Open the solution and search for the IdentitySample.Mvc project. Copy the necessary files to your project.

重要说明:不要忘记更改所添加文件的名称空间,因为它们属于不同的项目.

Important Note: Don't forget to change the namespace on the added files since they belong to a different project.

这篇关于ASP.NET Core-类似于MVC的脚手架标识的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆