Search code examples
asp.net-coreasp.net-identity

In ASP.NET Core 2.2, How to create a custom Registration Form


Seems like in ASP.NET Core 2.2, authentication is very different. For example, I want to customize both my Registration and Login forms and I can't find them in my project I scaffolded. The work, and clearly I can see them being called with this anchor tag helper:

<li class="nav-item">
    <a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Register">Register</a>
</li>
<li class="nav-item">
    <a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Login">Login</a>
</li>

in loginpartial.cshtml1

What confuses me is where is the view page /Account/Register and how do I modify it? Where are the model classes I might want to update? All those things use to be in the AccountController but that's now gone.


Solution

  • You could refer to Scaffold identity into an MVC project with existing authorization to add Identity.

    If you are using asp.net core 2.0, you would find it will generates AccountController in Controllers folder.

    If you are using asp.net core 2.1+, you will find all files in Areas/Identity/Pages/Account/Register.cshtml with Razor Pages structure.

    enter image description here