可能重複 Webmatrix WebSecurity not authenticatingPasswordReset在WebMatrix中WebSecurity不工作
這是我的PasswordReset.cshtml
頁:
@{
Layout="Layout.cshtml";
var uID = "";
var newPass = "";
var confirmPass = "";
var token = "";
if(IsPost){
uID = Request.Form["userID"];
newPass = Request.Form["newPassword"];
confirmPass=Request.Form["confirmPassword"];
token=WebSecurity.GeneratePasswordResetToken(uID, 5);
WebSecurity.ResetPassword(token, newPass);
}else{
Response.Redirect("Default");
}
}
現在,該錯誤信息是這樣的:
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0103: The name 'userID' does not exist in the current context
Source Error:
Line 10: newPass = Request.Form["newPassword"];
Line 11: confirmPass = Request.Form["confirmPassword"];
Line 12: token = WebSecurity.GeneratePasswordResetToken(userID, 5);
Line 13: WebSecurity.ResetPassword(token, newPass);
我認爲代碼是正確的,但我不能f找出錯誤的原因。請幫忙。
對,對不起。我的錯。我的意思是。 –
但仍然將我重定向到默認頁面。 我看不到我的HTML表單的其餘部分,用戶輸入新密碼。 –