4
I’m trying to develop a page, where after the user login, it is redirected to an index, where I would like to display the user name.
I’m using Identity
default of ASP.NET MVC
.
So I thought I’d put it on view
the following code:
<!-- menu profile quick info -->
<div class="profile">
<div class="profile_pic">
<img src="~/images/img.jpg" alt="..." class="img-circle profile_img">
</div>
<div class="profile_info">
<span>Seja Bem vindo,</span>
<h2>@Html.LabelFor(m => m.User.Identity.Name)</h2>
@*<h2>John Doe</h2>*@
</div>
</div>
But I’m having a hard time using that Razor
.
- It is correct to use
@Html.LabelFor
?
At the beginning of the page, I defined:
@model OneeWeb.Models.ApplicationUser
@{
ViewBag.Title = "Index";
}
- This is the model responsible for having user data?
If you want to show a value other than
Identity.Name
, advise that I extend the answer.– Randrade
Not the idea is really Name, but I did not understand why I can use direct
@User.Identity.Name
– Thomas Erich Pimentel