title: UserManager in ApiController
body: <p>In my project <em>HttpContext</em> is a member of Controller and I can use it in <em>AccountController : Controller</em>. But I can't access an information about current user in <em>ApiController</em> in contraction like </p>
  
  <pre class="lang-asp prettyprint-override"><code>public class AccountController : ApiController
  {
      public UserManager&lt;ApplicationUser&gt; UserManager { get; private set; }
      private IAuthenticationManager AuthenticationManager
      {
          get
          {
              return HttpContext.Current.GetOwinContext().Authentication;
          }
      }
  }
  </code></pre>
  
  <p>So how to write custom ApiController right?</p>
  
  <p>In the method below <em>user</em> variable shows me null on breakpoint. How can I retrive current user if I know that hi is logined?</p>
  
  <pre><code>    public IHttpActionResult GetUser(int id)
      {
          var manager = HttpContext.Current.GetOwinContext().GetUserManager&lt;ApplicationUserManager&gt;();
          var userid = User.Identity.GetUserId();
          var user = manager.FindById(userid);
  
          var data = new Person {Name = user.UserName, Age = 99};
  
          return Ok(data);
      }
  </code></pre>