As I can extend methods to access user properties?
There are methods like:
User.Identity.GetUserId()
User.Identity.GetUserName()
Which are accessible from the views and the controllers.
I want to extend this functionality with methods like:
User.Identity.GetUserPhoneNumber()
User.Identity.GetUserLanguaje()
Similar Question: Need access more user properties in User.Indentity answered by Microsoft professionals at codeplex worklog as below
We can get the application current User object in ASP.Net identity as below, from there you can access all properties of user object, we follow the same in mvc5 web-apps as of now.
In other controllers you will need to add the following to your controller:
Now we can access all user props(Phone# and Language) as below
EDIT: If you want to retrieve the same in any view.cshtml or _Layout.cshtml then you should do like below