asp.net-mvc 区域之间的 RedirectToAction?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1391887/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
RedirectToAction between areas?
提问by Jonathan
Is there a way to redirect to a specific action/controller on a different Area?
有没有办法重定向到不同区域的特定动作/控制器?
回答by eu-ge-ne
Did you try this?:
你试过这个吗?:
return RedirectToAction("action", "controller", new { area = "area" });
回答by Suhani Mody
Your answer was helpful to me. Just wanted to add below:
你的回答对我很有帮助。只想在下面添加:
If you want to redirect from one area to another area, above code works well.
如果你想从一个区域重定向到另一个区域,上面的代码效果很好。
And, if you want to redirect from one area to a controller/view which is not there in the area folder (i.e. in most cases, your front end), you can specify area = "".
而且,如果您想从一个区域重定向到区域文件夹中不存在的控制器/视图(即在大多数情况下,您的前端),您可以指定 area = ""。
i.e.
IE
return RedirectToAction("action", "controller", new { area = "" });

