【发布时间】:2014-08-31 08:21:18
【问题描述】:
请帮助我,在我的控制器中,我有 2 个名称相同的操作方法,名为 "Index",但参数不同..
public ActionResult Index()
{...}
[HttpPost]
public ActionResult Index(PickingMobile mi, string hdnSelectOperation, string btnMPSearch, string btnSearchMP)
{...}
现在我想从其他动作重定向到没有参数的索引动作
public ActionResult ConfirmBatchPicking(PickingMobile DirectPicking)
{
...
return RedirectToAction("Index", "ManualPickingSearch");// from here I need to redirect to first Index Method which does not have any parameters
}
但是当我保留断点并调试序列时,第一个 Index 方法没有被命中。请帮助我,如何重定向到第一个索引操作。
【问题讨论】:
-
由于您的 Index 方法之一是 HttpPost 类型,所以当您调用时返回 RedirectToAction("Index", "ControllerName")。这会将您重定向到 HttpGet 方法
-
但在调试时没有点击第一个 Index 方法
标签: asp.net-mvc asp.net-mvc-4 indexing redirecttoaction actionmethod