【发布时间】:2017-06-28 06:44:47
【问题描述】:
这个问题已经讨论过很多次了,但我还没有找到适合我的特殊情况的解决方案。
在我的 Umbraco (6) 视图之一中,我正在使用调用控制器方法
@Html.Action("Index", "CountryListing");
这会导致“路由表中没有路由”异常。
我一直在摆弄 RegisterRoutes 方法,但无济于事。我想知道当我清空 RegisterRoutes 方法时,它是否甚至被用作站点仍然可以运行。这是现在的样子:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
我也试过像这样在通话中添加一个空的“区域”
@Html.Action("Index", "CountryListing", new {area: String.Empty});
我在其他地方使用@Html.Action 语句并且它们确实有效,所以我明白为什么其中一些有效而另一些无效,但现在的主要问题是让我的国家/地区列表操作有效。
【问题讨论】:
标签: asp.net-mvc asp.net-mvc-routing umbraco6