public ActionResult Reset(ResetPassword resetPassword) { if (ModelState.IsValid) { //Confirm passwords: if (resetPassword.Password != resetPassword.PasswordConfirm) { ModelState.AddModelError("CoreServiceError", "Password and confirmation do not match!"); return(View(resetPassword)); } var claimResponse = new AccountManagementService.DataAccessResponseType(); var accountManagementServiceClient = new AccountManagementService.AccountManagementServiceClient(); try { //Attempt to send lost password claim accountManagementServiceClient.Open(); claimResponse = accountManagementServiceClient.ResetLostPassword(resetPassword.AccountNameKey, resetPassword.PasswordClaimKey, resetPassword.Password, Common.SharedClientKey); //Close the connection WCFManager.CloseConnection(accountManagementServiceClient); } catch (Exception e) { #region Manage Exception string exceptionMessage = e.Message.ToString(); var currentMethod = System.Reflection.MethodBase.GetCurrentMethod(); string currentMethodString = currentMethod.DeclaringType.FullName + "." + currentMethod.Name; // Abort the connection & manage the exception WCFManager.CloseConnection(accountManagementServiceClient, exceptionMessage, currentMethodString); // Upate the response object claimResponse.isSuccess = false; claimResponse.ErrorMessage = WCFManager.UserFriendlyExceptionMessage; //claimresponse.ErrorMessages[0] = exceptionMessage; #endregion } if (claimResponse.isSuccess) { return(RedirectToAction("Success", "Password")); } else { //ModelState.AddModelError("", "Invalid username or password."); //foreach (string error in authResponse.ErrorMessages) //{ ModelState.AddModelError("CoreServiceError", claimResponse.ErrorMessage); //} return(View(resetPassword)); } } else { return(View(resetPassword)); } }