How to redirect to Index from another controller?

后端 未结 7 1585
滥情空心
滥情空心 2020-12-02 11:06

I have been looking through trying to find some way to redirect to an Index view from another controller.

public ActionResult Index()
{                  


        
7条回答
  •  既然无缘
    2020-12-02 11:28

    You can use the overloads method RedirectToAction(string actionName, string controllerName);

    Example:

    RedirectToAction(nameof(HomeController.Index), "Home");
    

提交回复
热议问题