Can we call the Method of a controller from another controller in asp.net MVC?

后端 未结 6 1072
攒了一身酷
攒了一身酷 2021-02-07 10:45

Can we call the Method of a controller from another controller in asp.net MVC?

6条回答
  •  花落未央
    2021-02-07 11:15

    You could also simply redirect straight to the method like so:

    public class ThisController 
    {
        public ActionResult Index() 
        {
           return RedirectToAction("OtherMethod", "OtherController");
        }
    }
    

提交回复
热议问题