views:

131

answers:

1

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?

+1  A: 

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
...
Rafal Ziolkowski
THanks for the quick reply! It works perfectly.
Obi Juan Canoli
You are welcome :) Happy coding!
Rafal Ziolkowski