我具有以下验证验证码的属性:
[CaptchaValidation("CaptchaCode", "ForgotPasswordCaptcha", "Are You A Robot?")]
我的控制器方法使用该属性来验证ModelState:
[HttpPost]
[ActionName("ForgotPassword")]
[CaptchaValidation("CaptchaCode", "ForgotPasswordCaptcha", "Are You A Robot?")]
public ActionResult GetNewPassword(ForgotPasswordModel model, string returnUrl)
{
if(ModelState.IsValid)
{
//do something
}
else
{
return View();
}
}
这种方法可以正常工作,但是我需要更改错误消息,使其来自我的Global.resx文件。
我该怎么做?