Reputation: 759
My mvc5 application uses aspnet.identity authentication. Owin middleware is configured to use application cookies. All i want to achieve is to show user full name instead of the login in the LoginPartial view.
@Html.ActionLink("Hello, " + User.Identity.GetUserName() + "!", "Manage", "Account", routeValues: null, htmlAttributes: new { title = "Manage" })
I guess i need to customize my identity during creating it with user manager. Am I right?
private async Task SignInAsync(ApplicationUser user, bool isPersistent)
{
var identity = await userManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity);
}
I know I can store it in the session but what is the right way to store additional information?
Upvotes: 3
Views: 10027
Reputation: 17540
You can use claims to store the user's full name. Here is an article on how to add and retrieve custom claims using ASP.NET Identity.
Upvotes: 1