Display a view from another controller in ASP.NET MVC

后端 未结 7 1200
孤街浪徒
孤街浪徒 2020-11-29 16:06

Is it possible to display a view from another controller?

Say for example I have a CategoriesController and a Category/NotFound.aspx view.

7条回答
  •  甜味超标
    2020-11-29 16:26

    Yes its possible. Return a RedirectToAction() method like this:

    return RedirectToAction("ActionOrViewName", "ControllerName");
    

提交回复
热议问题