Programming and Technology

By Robert Roos

I recently started work on a small project in need of authentication and handling of users. The Identity provider https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-3.0&tabs=visual-studio is a good foundation for this and is highly customizable for most small project needs. Larger ones as well, but in combination with Identity Server.

With the release of .NET Core 2.2 there were some major changes done to Identity and how it's added to a project. Moving on from installing a NuGet (or using the default template in Visual Studio) with controllers and views set up in a MVC pattern, to Razor Pages/Razor Class Library instead.

This has it's pros and cons, personally I prefer the old MVC way. Razor Pages while quite nifty to work with in smaller projects, give me horrendous flashbacks to the old Web Forms way of doing things with a view and a code-behind file. And that is after scaffolding the library, that otherwise "just works" but hides the views and source code: https://docs.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-3.0&tabs=visual-studio#scaffold-identity-into-a-razor-project-with-authorization

By chance though i stumbled upon a project on Github I feel deserves some more recognition: https://github.com/TanvirArjel/AspNetCoreMvcIdentity

What this project offers is the old MVC way of Identity, where things are separated into views and controllers like before. So instead of doing the work yourself of moving everything into place, you can just use this instead, don't be like me and start the manual process BEFORE doing a search.

As of writing this the project seems to be well maintained and the author has just updated everything to work with the newly released .NET Core 3.0.