我在控制器中声明了一个 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 限制,它工作正常。
我错过了什么?