How does a View get displayed when there's no cshtml file? RRS feed

  • Question

  • User248267340 posted

    I just created a basic startup project in VS 2019, Core 2.1 with Individual user accounts.

    Once created, I noted that in Areas/Identity, there's no folder named "Account". No Login file, no Register file either.

    However, when I run the project, voila! on the navbar there's the link for Register and Login, and when I click I get a page to type in credentials, etc.

    How is that possible? Or, where is the page (view) coming from?

    Monday, April 20, 2020 11:42 PM


  • User-1330468790 posted

    Hi coreysan,


    Here I would like to introduce a concept for Razor class library (RCL) which means components are able to be shared and reused.

    Below link shows how to create an RCL and consume it.

    ASP.NET Core Razor components class libraries: Create an RCL and Consume a library component


    Let's back to track, the reason why you can directly direct to the Register and Login page is that they are already built in the RCL "Microsoft.AspNetCore.Identity".

    You could find "@using Microsoft.AspNetCore.Identity" statement in <_LoginPartial.cshtml> file and corresponding instances like "SignInManager<IdentityUser> SignInManager" included.


    If you would like to know more about it, you could refer to following link: 

    Scaffold Identity in ASP.NET Core projects

    Above link introduces that the identity RCL is included in the ASP.NET Core applications and you might want to generate source code so that you can modify the code and change the behavior by scaffolding identity into your project.


    Hope this can help you.

    Best regards,


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 21, 2020 2:24 AM