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();
}
}