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 ?
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)
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
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
-
0
did you also write
@{ var loginInfo = await SessionCache.GetCurrentLoginInformationsAsync(); }See your _Layout.cshtml.cshtml. It's already being used there.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
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.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)