是否有可能重定向到来自控制器的不同看法?例如,在这种情况下,我所有的控制器继承从有,我要重定向到不同的看法,如果某些条件不符合建筑工定制控制器。
Is it possible to redirect to a different view from a controller? For example in this case all my controllers inherit from a custom controller that has a constructer that I want to redirect to different view if certain criteria is not meet.
希望是有道理的。
感谢
您可以RedirectToAction,然后采取行动,你重定向到可以返回一个视图。要做到这一点最简单的方法是:
You can RedirectToAction, then the action you redirect to can return a view. The easiest way to do this is:
return RedirectToAction("Index", model);
然后,在你的指数方法,返回所需的视图。
Then in your Index method, return the view you want.