0
sbenfares created
I would like to get FirstName and LastName of my users in my chstml views.
With asp.net identity we can have @User.identity.Name but only the name is exposed.
What is the cleanest method to get User.FirstName & Lastname (& other properties) in ANZ ?
4 Answer(s)
-
0
hi,
You can get it from
SessionCache
.See
_Layout.cshtml.cshtml
@{ var loginInfo = await SessionCache.GetCurrentLoginInformationsAsync(); } <span>@loginInfo.User.Name</span>
Hope that helps
-
0
-
0
did you also write
@{ var loginInfo = await SessionCache.GetCurrentLoginInformationsAsync(); }
See your _Layout.cshtml.cshtml. It's already being used there.
-
0
I used the LoginInformations field in the HeaderViewModel, which contains exactly what i need.
No need for the variable in page, best use with the ViewModel.
Thanks for your help.