Membership修改密码

时间:2023-12-25 22:07:13
MembershipUser mu = Membership.GetUser(labelUserName.Text.Trim());//获取资格用户
  try
    {
      bool flat = mu.ChangePassword(txtOldPassword.Text.Trim(), txtPassword.Text.Trim());
      if (flat == true)
        {
          Response.Write("<script>alert('修改成功!');</script>");
        }
      else
        {
          Response.Write("<script>alert('修改失败!');</script>");
        }
  catch (Exception ex)
    {
      Response.Write("<script>alert('" + ex.Message.ToString() + "');</script>");
    }