我们可以从asp.net MVC中的另一个控制器调用一个控制器的方法吗?
问题描述:
我们可以从asp.net MVC中的另一个控制器调用一个控制器的方法吗?
Can we call the Method of a controller from another controller in asp.net MVC?
答
您还可以直接将其直接重定向到该方法,如下所示:
You could also simply redirect straight to the method like so:
public class ThisController
{
public ActionResult Index()
{
return RedirectToAction("OtherMethod", "OtherController");
}
}