【发布时间】:2011-03-03 11:44:34
【问题描述】:
我的控制器中声明了一个 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 限制,它可以正常工作。
我错过了什么?
【问题讨论】:
标签: c# asp.net-ajax asp.net-mvc-2 routing actionlink