1

when I set the AuthCookie like this

FormsAuthentication.SetAuthCookie(model.UserName, true);

the model.userName is actually the users email which is what uniquely identifies each user, then on my view when I use:

Welcome <strong> @User.Identity.Name</strong>!

it displays "Welcome [email protected]!, however I would like to user the user.firstname.

So, my question is, is it possible to implement a custom User.Identity or a custom Forms.SetAuthCookie that will allow me to use something like this on my view:

Welcome <strong> @User.Identity.FirstName</strong>!

1 Answer 1

1

You can access some information provided by the MembershipUser class. However, there is no property for first name or last name, which means you need to implement a custom membership user / provider. See this article.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.