ASP.Net Identity on Visual Studio 2019

Hello,

I am using Visual Studio 2019 and started as described in the tutorial a new MVC project.
But it seems like that all the Identity classes and functionalities for authorization are not included in my project. Doea anyone know why?

Thank you in advance and reagrds
Nili

2 Likes

Thank you for you answer!
No, I didn’t changed it, but the default setting was no authentication.
I started a new project now with “Individual User Accounts” and now everything was there.

Yes, the video series should have an update to explain individual user accounts should be selected when creating the project, because VS 2019 defaults to no auth, which prevents scaffolding out Entity Framework and Identity libraries.

In the current course on Teachable, it doesn’t cause an issue until section 3 (Working with Data), because it uses Entity Framework. To resolve this issue, refer here: Enable -migration not working

The next problem is missing Identity libraries, which are required in section 8 (Authentication). Here’s an outline of a great way to quickly get this working. ASP.Net MVC: Change from "No Authentication" to "Individual User Accounts" on existing project - Stack Overflow

Be sure your DbSet definitions for applicationDbContext (IdentityModels.cs).

To be clear in regards to copying/adding files to solution from the “dummy” project over to your live project, I would recommend using the “Add Existing” option in solution explorer, then you can select the files/directories needed and they will be added to the solution. If you simply copy them over to the directory using something like File Explorer, you would still need to manually add them to the solution.