How to redirect to Index from another controller?

后端 未结 7 1584
滥情空心
滥情空心 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:35

    Use the overloads that take the controller name too...

    return RedirectToAction("Index", "MyController");
    

    and

    @Html.ActionLink("Link Name","Index", "MyController", null, null)
    

提交回复
热议问题