title: Cannot convert from System.security.claims.claimsPrincipal to Scheduler.Areas.Identity.Data
body: <p>I'm trying to get the current user ID so my Events index page will show events from only current user.</p>
  <p>my HttpContext.User has the error &quot;Cannot convert from System.security.claims.claimsPrincipal to Scheduler.Areas.Identity.Data&quot; inside the index of my Events controller.</p>
  <pre><code>var userId = await _userManager.GetUserIdAsync(HttpContext.User);
  </code></pre>
  <p>Here is the code in my EventsController:</p>
  <pre><code>public EventsController(SchedulerDbContext context, UserManager&lt;SchedulerUser&gt; userManager)
  {
      _context = context;
      _userManager = userManager;
  }
  
  // GET: Events
  [Authorize]
  public async Task&lt;IActionResult&gt; Index()
  {
      var userId = await _userManager.GetUserIdAsync(HttpContext.User);
      return View(await _context.Events.Where(g =&gt; g.SchedulerUser == userId).ToListAsync());
  }
  </code></pre>
  <p>Where should I be looking to solve this? I'll update with more code if required.</p>