I have a problem solving 404 error:
The default route in Global.asax.cs:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
VideoController.cs:
[HttpPost]
public ActionResult Save(int id)
{
try
{
return Json(new
{
ID = "0"
});
}
catch
{
return new HttpStatusCodeResult(418, "I'm a teapot");
}
}
ActionLink in my opinion, Create.cshtml:
@Ajax.ActionLink("GoSave", "Save", "Video", new { id = 1 },
new AjaxOptions { OnFailure = "Error", OnSuccess = "Saved",
HttpMethod = "POST" })
The actionlink URL displays as expected: / Video / Save / 1
When I click on the link, I get 404.
What I do not see?
source
share