我有以下控制器:
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
并且,路线:
routes.MapRoute(
"spa",
"{section}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new { section = @"home|questions|admin" });
当我使用以下内容时,我收到一条错误消息:
return RedirectToAction("Index", "Home");
错误信息:
Server Error in '/' Application.
No route in the route table matches the supplied values.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: No route in the route table matches the supplied values.
有人可以向我解释为什么这不起作用以及为什么以下工作:
return Redirect("~/home");