无法重定向路由 table 中没有路由与提供的值匹配。在 MVC 5 中
Unable to Redirect No route in the routing table matches the supplied values. in MVC 5
无法重定向到某些显示错误的页面“路由 table 中的路由与提供的值不匹配。在 MVC 5 中”
[Route("Job")]
public ActionResult Index()
{
return View();
}
// Redirect
[Route("Job/Logout")]
public ActionResult logout() {
return RedirectToAction("Job");
}
您正在将路由属性值传递给 RedirectToAction
。相反,您需要 ActionResult
的名称,在本例中为 Index.
return RedirectToAction("Index");
无法重定向到某些显示错误的页面“路由 table 中的路由与提供的值不匹配。在 MVC 5 中”
[Route("Job")]
public ActionResult Index()
{
return View();
}
// Redirect
[Route("Job/Logout")]
public ActionResult logout() {
return RedirectToAction("Job");
}
您正在将路由属性值传递给 RedirectToAction
。相反,您需要 ActionResult
的名称,在本例中为 Index.
return RedirectToAction("Index");