1
i am developing an application in ASP.NET MVC, by default it already comes with a predefined template, however when logging in the application is displayed the message "Hello [email protected] !" but I wanted instead of appearing the email to be displayed the name of the logged in person, because I created this field in the database, to store the name on the Register screen. Could someone help me with this?
Below the section responsible for displaying the message on the screen:
using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" }))
{
@Html.AntiForgeryToken()
<ul class="nav navbar-nav navbar-right">
<li>
@Html.ActionLink("Olá " + User.Identity.GetUserName() + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" })
</li>
<li><a href="javascript:document.getElementById('logoutForm').submit()">Sair</a></li>
</ul>
}
Yes, someone could help. What is the snippet of code that puts the message on screen?
– Oralista de Sistemas
@Renan I did not think it was necessary to include the excerpt, because it is standard in all projects Asp net mvc when we create!
– WPfan
It is common to customize this code... Anyway, I think there is now enough information.
– Oralista de Sistemas
@Renan how would this customization, do you have any idea? The most %&*@ is that I’ve already done this, so it’s a long time and I don’t have the project to look at!
– WPfan
I’m also rusty. I hope you get a good answer. If I don’t get one by tomorrow, I can put a reward on this question. Anyway... The ideal would be for you to load an object that represents the user through the MVC framework of ASP.NET. Place this object on the page and all its fields will be available in the frontend.
– Oralista de Sistemas
You want the full name or Username?
– Barbetta
It can be the full name, no problem, I just want it to not be the email, because the login here in this case is not done with username only with the same email, It was the request of the company, if the login was done this way would be easier!
– WPfan