Obi Juan Canoli
Obi Juan Canoli

Reputation: 23

Membership - get user email

I am using ASP.Net MVC2 with the default membership/profile/role providers, I'd like to access the user email in my ForgotPassword Action to email a new password to the user, but so far I've only been able to get the username (User.Identity.Name).

Am I missing something here?

Upvotes: 1

Views: 3984

Answers (1)

user170442
user170442

Reputation:

You need to access user information in MembershipUser class using Membership class, f.ex:

...
MembershipUser u = Membership.GetUser(username);
//u.Email - this is user's email
...

Upvotes: 4

Related Questions