本文整理汇总了C#中System.Web.Security.MembershipUser.ChangePasswordQuestionAndAnswer方法的典型用法代码示例。如果您正苦于以下问题:C# MembershipUser.ChangePasswordQuestionAndAnswer方法的具体用法?C# MembershipUser.ChangePasswordQuestionAndAnswer怎么用?C# MembershipUser.ChangePasswordQuestionAndAnswer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Security.MembershipUser
的用法示例。
在下文中一共展示了MembershipUser.ChangePasswordQuestionAndAnswer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeSecurityQuestionAndAnswer
/// <summary>
/// Change security question and answer
/// </summary>
/// <param name="user">Membership user</param>
/// <param name="password">current password</param>
/// <param name="newQuestion">new question</param>
/// <param name="newAnswer">new answer</param>
/// <returns>Return true if security question changed</returns>
public bool ChangeSecurityQuestionAndAnswer(MembershipUser user, string password, string newQuestion,
string newAnswer)
{
return user.ChangePasswordQuestionAndAnswer(password, newQuestion, newAnswer);
}
示例2: ChangePasswordQAHelper
private void ChangePasswordQAHelper(MembershipUser user, string pw, string newQ, string newA)
{
try
{
user.ChangePasswordQuestionAndAnswer(pw, newQ, newA);
Assert.Fail("This should not work.");
}
catch (ArgumentNullException ane)
{
Assert.AreEqual("password", ane.ParamName);
}
catch (ArgumentException)
{
Assert.IsNotNull(pw);
}
}
示例3: lbtnSecurity_Click
/// <summary>
/// this method is used to change the user Security question and answer //Developed by swaraj on 19 feb 2010
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbtnSecurity_Click(object sender, EventArgs e)
{
try
{
objMembershipUser = Membership.GetUser(User.Identity.Name);
bool Result = objMembershipUser.ChangePasswordQuestionAndAnswer(txtPwd.Text.ToString(), txtSecurityQue.Text.ToString(), txtSecurityAns.Text.ToString());
if (Result == true)
{
lblMsg.ForeColor = System.Drawing.Color.Green;
lblMsg.Text = "Security Question and Answer has been changed successfully";
txtPwd.Text = "";
txtSecurityAns.Text = "";
txtSecurityQue.Text = "";
}
else
{
lblMsg.ForeColor = System.Drawing.Color.Red;
lblMsg.Text = "Please verify the password";
}
}
catch (Exception ex)
{
throw ex;
}
}