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