skip to Main Content

I am learning ASP.NET coming from a Node.js background.

When I create a new MVC project, I can choose to have built-in register/login.

enter image description here

This gives me the following views, where I can register and login.

enter image description hereenter image description here

But I am confused as I cannot find the corresponding controller or views in the directory, which is problematic if I want to customize the behaviour.

enter image description here

Can someone shed the light on how this works and where are the controller and view? Thanks.

2

Answers


  1. It is not in project folder. UI is loaded from Microsoft.AspNetCore.Identity.UI library.

    You can check it’s code in below URL. you can understand how to configure by looking at code.

    https://github.com/dotnet/aspnetcore/tree/main/src/Identity/UI/src

    They are not using MVC style, they are using Razor pages with code behind C# model.

    You can provide your own UI by using attribute like [IdentityDefaultUI(typeof(LoginModel<>))] on your page model.

    Reference:
    https://github.com/dotnet/aspnetcore/blob/main/src/Identity/UI/src/Areas/Identity/Pages/V5/Account/Login.cshtml.cs

    Login or Signup to reply.
  2. The controller folder contains the controller file in which you will see the server side(C#) code it will receive request from view and process on it and send back to view. And views folders contains the html code that get input from user. In this project structure, you will see shared folder that contains generic view files and _loginpartial.cshtml is login view.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search