MVCConrib のModelStateToTempDataを使用している場合でも、リダイレクト後に検証メッセージが表示されないという問題があります。私は何か基本的なことを見落としていますか?
[ModelStateToTempData]
public class AccountController : BaseController
{
public ActionResult LogOn(string email, string password, string returnUrl)
{
if (!ValidateLogOn(email, password))
{
return RedirectToAction("Index", "AnotherController");
}
//other stuff
}
private bool ValidateLogOn(string email, string password)
{
if (!_userTask.ValidateUser(email, password))
{
ModelState.AddModelError("message", "The email or password provided is incorrect.");
}
return ModelState.IsValid;
}
}
意見:
<li>
<label for="email">E-mail</label>
<%= Html.TextBox("email")%>
<%= Html.ValidationMessage("message") %>
</li>