我不知道为什么我的 WebSecurity.ChangePassword 不起作用。这是我正在处理的一段代码。
if (WebSecurity.ChangePassword(USER, oldpass, password)) {
Response.Redirect("~/SuperAdmin");
return;
}else {
ModelState.AddFormError(USER);
// I put the each WebSecurity.ChangePassword parameter to this parameter to check whether
//each parameter valid or not (print it out)
}
对于 WebSecurity.ChangePassword 的每个参数,我从数据库中检索它,如下所示
if(IsPost){
Validation.RequireField("email", "Masukkan email");
Validation.RequireField("password", "Masukkan Password");
Validation.RequireField("userid", "user ID tidak ada!");
email = Request.Form["email"];
password = Request.Form["password"];
userId = Request.Form["userId"];
if(Validation.IsValid()){
var db = Database.Open("StarterSite");
var updateCommand2 = "UPDATE UserProfile SET Email=@0 WHERE UserId=@1";
db.Execute(updateCommand2, email,userId);
var USER = db.QueryValue("SELECT a.Email FROM UserProfile a, webpages_Membership b WHERE a.UserId=b.UserId AND a.UserId= @0", userId);
var oldpass = db.QueryValue("SELECT Password FROM webpages_Membership WHERE UserId = @0", userId);
谁能告诉我这里似乎有什么问题?提前致谢