我在控制器中声明的POST方法:MVC Ajax.ActionLink没有找到POST方法
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult UpdateComments(int id, string comments)
{
// ...
}
和ActionLink的在我看来:
<%= Ajax.ActionLink("update", "UpdateComments",
new { id = Model.Id, comments = "test" },
new AjaxOptions {
HttpMethod="POST",
OnFailure="alert('fail');",
OnSuccess = "alert('success');"
})%>
我得到一个“未找到“错误,当它试图路由这个请求。
如果我从控制器的UpdateComments方法中删除POST限制,它工作正常。
我错过了什么?
这些都是在MVC3和MVC4过时。请参阅:http://stackoverflow.com/a/8784998/210780 – ashes999 2013-04-18 17:44:08