I am writing a C# MVC5 internet application and am having some trouble getting the 'ApplicationUser' object in a controller that I have created.
Here is my code:
Code:
var userManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
ApplicationUser user = userManager.FindByNameAsync(User.Identity.GetUserId()).Result;
When I try to run this code, when a user is logged in, I am getting a null object for the 'ApplicationUser' user.
Can I please have some help with this?
Thanks in advance