0
次のコードは、アンカーと動作するビューにリダイレクトされます。しかし、検証のためにモデルの状態を送信する必要があり、リダイレクトを使用している間にそれを行う方法がわかりません。モデルエラーを設定して検証サマリを入力したいと思います。MVC ASP.NET - モデル状態でアンカーにリダイレクト
[HttpPost]
public ActionResult Send(QuoteModel model, string CatchAll)
{
try
{
if (ModelState.IsValid)
{
}
else
{
ModelState.AddModelError(string.Empty, "There is something wrong with Foo.");
return Redirect(Url.RouteUrl(new { controller = "Home", action = "Index"}) + "#quote");
}
}
catch
{
return View();
}
}