I am trying to display information of the current logged in user. In the AccountController, I added the following action method:
public class AccountController : Controller
{
    private ApplicationSignInManager _signInManager;
    private ApplicationUserManager _userManager;
    public AccountController()
    {
    }
    public ApplicationUserManager UserManager
    {
        get
        {
            return _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
        }
        private set
        {
            _userManager = value;
        }
    }
    //.......
    public ActionResult Profile()
    {
        var userId = User.Identity.GetUserId();
        if(userId == null)
        {
            return RedirectToAction("Login", "AccountControler");
        }
        else
        {
            ApplicationUser user = _userManager.FindByIdAsync(userId).Result;
            return View(user);
        }
    }
}
However, I get the following exception:
Object reference not set to an instance of an object. _userManager was null
 
     
    