I have created a Web Application MVC project with Individuals User Accounts authentication.
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.
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)?
ASP.NET Core provides many tools and libraries to secure ASP.NET Core apps such as built-in identity providers and third-party identity services such as Facebook, Twitter, and LinkedIn.
ASP.NET Core Identity provides a framework for managing and storing user accounts in ASP.NET Core apps. Identity is added to your project when Individual User Accounts is selected as the authentication mechanism. By default, Identity makes use of an Entity Framework (EF) Core data model.
ASP.NET Scaffolding is a code generation framework for ASP.NET Web applications. Visual Studio 2013 includes pre-installed code generators for MVC and Web API projects. You add scaffolding to your project when you want to quickly add code that interacts with data models.
For anyone that wants to "scaffold" identity on MVC, I recommend the following approach:
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.
No, it is not possible. The Identity team decided to switch to Razor Pages for the default UI, and now that is all there is. If you like, you can manually create controllers and views, referencing code from the scaffolded Razor Pages to create the same thing in MVC, but that is on you. There is no automatic way to do so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With