2013-05-29 5 views
0

Возможные дублируют Webmatrix WebSecurity not authenticatingPasswordReset с WebSecurity в WebMatrix не работает

Это моя 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); 

Я думаю, что код правильный, но я не могу Измените причину ошибки. Пожалуйста помоги.

ответ

0

Эта переменная не существует в контексте выше. Вы храните идентификатор пользователя из Request.Form в uId, так вы имели в виду:

WebSecurity.GeneratePasswordResetToken(uID, 5); 
+0

да, извините. моя вина. Я имею ввиду это. –

+0

Но это все еще перенаправляет меня на страницу по умолчанию. Я не могу видеть остальную часть моей HTML-формы, когда пользователь вводит новый пароль. –

Смежные вопросы