Membership 重置密码

public ActionResult ChongZhiMiMa()
        {
            Membership.GetUser("admin").UnlockUser();//清除用户的锁定状态以便可以验证成员资格用户。
            string newspassword = Membership.GetUser("admin").ResetPassword();
          
            ViewData["newspassword"] = newspassword;
            Membership.GetUser("admin").ChangePassword(newspassword, "123456");
            var script = String.Format("<script>alert('重置成功,新密码为 123456 请牢记!');location.href='{0}'</script>", Url.Action("logon"));
            return Content(script, "text/html");
        }

原文地址:https://www.cnblogs.com/heifengwll/p/3473307.html