protected void LinkButtonChangePassword_Click(object sender, EventArgs e) { StartPasswordChangeAttemptResponse response = null; try { using (WebSSOServiceSoapClient client = new WebSSOServiceSoapClient("WebSSOServiceSoapClient")) { client.Open(); StartPasswordChangeAttemptRequest request = new StartPasswordChangeAttemptRequest() { // In this example, SuccessUri and FailureUri are set to the same value. The response // to each End<X>Attempt() contains enough information to distinguish // between a success result and a failure result. ChangePasswordResult.aspx illustrates // how to do this. SuccessUri = ConfigurationManager.AppSettings["ChangePasswordResultUri"], FailureUri = ConfigurationManager.AppSettings["ChangePasswordResultUri"], CancelAllowed = true }; response = client.StartPasswordChangeAttempt(request); } } catch (Exception ex) { LabelMessage.Text = HttpUtility.HtmlEncode(string.Format("Exception of type {0} raised when calling WebSSOService.StartPasswordChangeAttempt(). {1}", ex.GetType().FullName, ex.Message)); } if (response != null) { // The change password attempt ID is placed in the session to act as a "marker" that // a change password attempt is in progress. It's used later to avoid a call to // EndChangePasswordAttempt() if no change password attempt is in progress. Session["ChangePasswordAttempt"] = response.PasswordChangeAttemptId; Response.Redirect(response.RedirectUri); } }
public ActionResult ChangePassword() { StartPasswordChangeAttemptResponse response = null; try { using (WebSSOServiceSoapClient client = new WebSSOServiceSoapClient("WebSSOServiceSoapClient")) { client.Open(); StartPasswordChangeAttemptRequest request = new StartPasswordChangeAttemptRequest() { // In this example, SuccessUri and FailureUri are set to the same value. The response // to each End<X>Attempt() contains enough information to distinguish // between a success result and a failure result. ChangePasswordResult() illustrates // how to do this. SuccessUri = ChangePasswordResultUri, FailureUri = ChangePasswordResultUri, CancelAllowed = true }; response = client.StartPasswordChangeAttempt(request); } } catch (Exception ex) { Session["Message"] = HttpUtility.HtmlEncode(string.Format("Exception of type {0} raised when calling WebSSOService.StartPasswordChangeAttempt(). {1}", ex.GetType().FullName, ex.Message)); return SignInPageRedirect; } // The change password attempt ID is placed in the session to act as a "marker" that // a change password attempt is in progress. It's used later to avoid a call to // EndChangePasswordAttempt() if no change password attempt is in progress. Session["ChangePasswordAttempt"] = response.PasswordChangeAttemptId; return Redirect(response.RedirectUri); }