如何从我的区域之一链接到我的根 Controller 之一?
<% Html.RenderAction("Action", "Page", new {area = "root", name = "Admin"}); %>
这给了我一个错误:
No route in the route table matches the supplied values.
我的根 Controller 集合中名为 Admin
的文件夹中有一个名为 Page
的 Controller 。
我可以通过键入\Admin\Page 访问此 Controller 。
这是我注册路线的方式:
routes.MapRoute(
"Admin",
"Admin/{controller}/{action}/{id}",
new { controller = "Admin", action = "Index", id = "" }
);
我希望我可以使用我认为的这种语法来处理“Admin”路由,但这没有用。关于如何修复它的任何想法?
最佳答案
<% Html.RenderAction("Action", "Controller", new { area = "" }); %>
关于c# - 从 ASP MVC 中的区域 Controller 链接到根 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2126913/