I am in the admin area now I want to send the values to the Account Controller, which is in the default area, how can I send
ChangePasswordModel mode = new ChangePasswordModel();
mode.ConfirmPassword = password;
mode.NewPassword = password;
mode.OldPassword = user.Password;
return RedirectToAction("ChangePassword", "Account",new { area = '/' } , new {model = mode});
this is my other action in Account Controller where I want to redirect my code
[Authorize]
[HttpPost]
public ActionResult ChangePassword(ChangePasswordModel model)
{
if (ModelState.IsValid)
{
bool changePasswordSucceeded;
try
{
MembershipUser currentUser = Membership.GetUser(User.Identity.Name, true );
changePasswordSucceeded = currentUser.ChangePassword(model.OldPassword, model.NewPassword);
}
catch (Exception)
{
changePasswordSucceeded = false;
}
if (changePasswordSucceeded)
{
return RedirectToAction("ChangePasswordSuccess");
}
else
{
ModelState.AddModelError("", "The current password is incorrect or the new password is invalid.");
}
}
return View(model);
}
source
share