How to get the current logged in user ID in ASP.NET Core?

I’ve done this before with MVC5 using User.Identity.GetUserId() but that doesn’t seem to work here.
The User.Identity doesn’t have the GetUserId() method.

I am using Microsoft.AspNet.Identity.

20 Answers
20

Leave a Comment