0

I'm creating a new asp.net MVC3 app in which in user table I do not wish to have user name but only user id (long) and email (string). What I would like to understand is normally when I use membership provider with normal db structure, I get the username value in db as the User.Identity.Name.

Could someone please tell me what changes I need to do as I will not have any username in my db to ensure that my email address becomes my User.Identity.Name

Thanks Arnab

Answer: found out... its FormsAuthentication.SetAuthCookie that decides which value goes to user.identity.name

1
  • if you find yourself the answer, please use an answer instead of editing your question. Then, you will be able to mark it as answer, and mark the question as answered.
    – Steve B
    Sep 24, 2011 at 22:35

2 Answers 2

0

The value User.Identity.Name typically comes from the "username" you provide the login form. This is stored by the LogOnModel class within the AccountModels model.

To set your email address as User.Identity.Name, you must provide your email address in the username field of the login form. Then use your membership provider to authenticate the user based on the provided email address.

2
  • but my present logon model class does not have any username but just login id, and I get user.identity.name, it is more likely to be something to do with membership provider as u said, but any idea exactly what happens when u login...
    – Arnab
    Sep 22, 2011 at 6:44
  • found out... its FormsAuthentication.SetAuthCookie that decides which value goes to user.identity.name
    – Arnab
    Sep 24, 2011 at 22:32
0

found out... its FormsAuthentication.SetAuthCookie that decides which value goes to user.identity.name

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.