How do you obtain user profile values in ASP.NET Identity 2 of current user?

asp.net, asp.net-identity, asp.net-identity-2, c#

Solution

You need to get the `IdentityUser` object (probably a descendant like `ApplicationUser` in your application) from Entity Framework. There are a number of ways you could do this, depending on where you are and so on. But, for example, if you wanted to do that in the controller, where you have access to the currently logged in user with the `User` property, you could use `UserManager<TUser>.FindById()` like this:

// UserManager here is an instance of UserManager<ApplicationUser>
var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
var number = user.PhoneNumber;

Problem

In an MVC5 application how do you get values from the AspNetUsers table for the current user? For example: one of the default fileds is PhoneNumber. How do you get the phonenumber of the current logged in user? I am using Identity 2...

Original source