Identity in ASP.Net Core 2.1 : Customize AccountController

Ogglas picture Ogglas · Jun 4, 2018 · Viewed 38.2k times · Source

I have installed ASP.NET Core 2.1 but even though I have created a new ASP.NET Core Web Application using ASP.NET Core 2.1 with Individual User AccountsStore user accounts in-app I can't find the AccountController or Views.

I can still register and login without a problem but I can't find the code for it, it were present in 2.0.

enter image description here

Answer

Xeevis picture Xeevis · Jun 4, 2018

ASP.NET Core 2.1 introduced new feature called Razor class libraries that lets you build views and pages as part of reusable library. ASP.NET Core Identity was moved to such RCL. You can override it in your project:

  1. From Solution Explorer, right-click on the project > Add > New Scaffolded Item.
  2. From the left pane of the Add Scaffold dialog, select Identity > ADD.
  3. In the ADD Identity dialog, choose files you wish to override.
    1. Select layout if necessary
    2. Select or create Data context class.
  4. Hit ADD.

For more information visit documentation.