Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core Identity - where is Account Controller and Folder

I am new to .NET Core and wanted to ask about Identity.

I bought a book and followed all the instruction. It is very simple to set Identity the way the book describes. Create an Account Controller, LogIn, Logout views etc...

But when I create a new project with Visual Studio with Individual User Accounts selected.

I can't find the Account Controller folder. There is an Areas folder but almost empty. Areas\Idnetity\Pages\_ViewStart.html.

I checked hidden files etc, but couldn't find Account or Identity Folder.

The login link is like this

 https://localhost:44313/Identity/Account/Login

Identity is working but where are the codes?

like image 392
AliAzra Avatar asked Dec 14 '25 18:12

AliAzra


2 Answers

As this entry states:

In ASP.NET Core 2.1 we can now ship Razor UI in reusable class libraries. We are using this feature to provide the entire identity UI as a prebuilt package (Microsoft.AspNetCore.Identity.UI) that you can simply reference from an application.

Notice that you are asking this feature to be effective by adding .AddDefaultUI(UIFramework.Bootstrap4) to ConfigureServices method.

If you still love to scaffold the Identity as old days, use this cli command:

dotnet aspnet-codegenerator identity --useDefaultUI

For more information on scaffolding options visit here.

like image 192
Afshar Mohebi Avatar answered Dec 18 '25 08:12

Afshar Mohebi


If you right click your MVC project, go to Add, and select "new scaffolded item," there should be option to select "Identity." Click Add. After that a pop up menu should appear, and you can choose which Identity razor page from the razor class library you want to add (login, register, etc...). This will add the Identity razor page to the Areas\Identity\Pages directory, and you can review/modify the code as you wish.

like image 42
Doug Avatar answered Dec 18 '25 08:12

Doug



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!