public ActionResult Forgot(PasswordClaim passwordClaim) { if (ModelState.IsValid) { var claimResponse = new AccountManagementService.DataAccessResponseType { isSuccess = false }; var accountManagementServiceClient = new AccountManagementService.AccountManagementServiceClient(); try { //Attempt to send lost password claim accountManagementServiceClient.Open(); claimResponse = accountManagementServiceClient.ClaimLostPassword(passwordClaim.AccountNameKey, passwordClaim.Email, 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("sent", "password")); } else { //ModelState.AddModelError("", "Invalid username or password."); //foreach (string error in authResponse.ErrorMessages) //{ ModelState.AddModelError("CoreServiceError", claimResponse.ErrorMessage); //} return(View(passwordClaim)); } } else { return(View(passwordClaim)); } }