MVC Beerhouse - ForgotPassword action method

Dec 11, 2009 at 5:42 PM


I'm making my way through the book, but I'm having difficulty understanding something written on page 122 about the ForgotPassword action method:

if (Membership.ValidateUser(userName, resetPassword))
FormsAuthentication.SetAuthCookie(userName, false);
return RedirectToAction(“ChangePassword”, new { resetPassword = resetPassword });

Could someone explain why we're passing "resetPassword = resetPassword" as a parameter? After some googling, it appears that we're passing a RouteValueDictionary, but I'm still unclear about the magic happening here.



Jan 6, 2010 at 10:22 PM

I believe it is redirecting to the action ChangePassword with a string parameter, this action will set a new User as model with the new resetPassword as password and return the view for new password data entry. The Post ChangePassword action then collects this User and work with Membership User to set the new password defined the end user.


Jan 7, 2010 at 1:27 PM

I'm still unclear about the syntax. resetPassword = resetPassword looks to be a simple assignment, but obviously it is doing much more. Could someone explain why resetPassword = resetPassword isn't redundant?