【发布时间】:2011-03-25 19:22:38
【问题描述】:
我无法解决 404 错误:
Global.asax.cs 中的默认路由:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
视频控制器.cs:
[HttpPost]
public ActionResult Save(int id)
{
try
{
return Json(new
{
ID = "0"
});
}
catch
{
return new HttpStatusCodeResult(418, "I'm a teapot");
}
}
在我看来,ActionLink Create.cshtml:
@Ajax.ActionLink("GoSave", "Save", "Video", new { id = 1 },
new AjaxOptions { OnFailure = "Error", OnSuccess = "Saved",
HttpMethod = "POST" })
actionlink的url按预期呈现:/Video/Save/1
当我点击链接时,我得到一个 404。
我没看到什么?
【问题讨论】:
标签: asp.net-mvc asp.net-mvc-3 routing