new*_*_86 6 asp.net-mvc asp.net-mvc-3
是否可以有2个具有相同名称和参数的动作,但一个是帖子,另一个是get?例如Delete(id),[HttpPost]Delete(id)...我得到一个错误,说这是不允许的......
是的,这是可能的.只需在一个操作上使用ActionName属性:
public ActionResult Delete(int id)
{
//...
return View();
}
[HttpPost]
[ActionName("Delete")]
public ActionResult Delete_Post(int id)
{
//...
return View();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2015 次 |
| 最近记录: |