using System.Web.Security;
I'm creating a resetPassword form in MVC4:
using System.Web.Security;
[HttpPost]
[AllowAnonymous]
public ActionResult ResetPassword(ResetPasswordModel model)
{
MembershipUser u = Membership.GetUser(model.Username);
if (HashResetParams(u.UserName, u.ProviderUserKey.ToString()) == model.Key)
{
string resetCode = u.ResetPassword();
u.ChangePassword(resetCode, model.Password);
}
return View("ChangePasswordSuccess");
}
Any idea why I'm getting a "ResetPassword- Specified Method not supported" error when I hit the line:
string resetCode = u.ResetPassword();
I wonder if it has something to do with MVC4 projects defaulting to use the SimpleMembership implementation.
Also, I've seen various approaches on how to reset passwords in ASP.NET Membership, perhaps there's a better way?
enablePasswordReset="true"
in the add-provider tag in web.config. – Henk Holterman