0
votes

I'm currently developing a asp.net (MVC) where I'm storing additional information in the Users table i.e. First Name, Last Name, Date of birth, etc... Standard data!!

When I login, I use the email address as the Username, but instead of displaying the email address in the login page (_LoginPartial.cshtml), I want to display FirstName + " " + LastName instead.

In the _LoginPartial.cshtml, the code to display the "username" which happens to be the "email" address in my case looks like

Hello, @Html.ActionLink(User.Identity.Name, "Manage", "Account", routeValues: null, htmlAttributes: new { @class = "username", title = "Manage" })!

but instead of wanting to use User.Identity.Name, I want to use the FirstName & LastName associated with that email address, so I've got a couple of questions in regards to this:

  1. How to I get the user info/data - I can't see a .GetUser function. Do I need to implement my own? If so, where do I put this code?

  2. What do I need to replace User.Identity.Name with?

Many thanks.

Thierry

1
@Thiery Can you plz tell me .GetUser function it's your own function i mean this function you are getting from membership or you create your own function and also tell me that what's your exact requirement plz tell me . - Rajpurohit

1 Answers

0
votes

Membership is a system that is used strictly for user credentials. Logging in with a username and password. That's it. It doesn't care about names, or phone numbers or anything else.

You can extend the User table with this information, but you will have to look it up in the database yourself. Using whatever data access technology you wish.