Asp.net mvc 未找到路由或路由构造不正确
以下是我在global.asax.cs中的路线定义:Asp.net mvc 未找到路由或路由构造不正确,asp.net-mvc,model-view-controller,asp.net-mvc-2,localization,routing,Asp.net Mvc,Model View Controller,Asp.net Mvc 2,Localization,Routing,以下是我在global.asax.cs中的路线定义: routes.Add( new NamedTypedRoute( "feedback-en", RouteType.Regular, "{culture}/Feedback", new RouteValueDictionary( new { culture = "en", controller = "Feedback", action = "Index
routes.Add(
new NamedTypedRoute(
"feedback-en", RouteType.Regular, "{culture}/Feedback",
new RouteValueDictionary(
new
{
culture = "en",
controller = "Feedback",
action = "Index"
}
),
null,
new MultiLingualMvcRouteHandler()
)
);
routes.Add(
new NamedTypedRoute(
"feedback-sl", RouteType.Regular, "{culture}/Kontakt",
new RouteValueDictionary(
new
{
culture = "sl",
controller = "Feedback",
action = "Index"
}
),
null,
new MultiLingualMvcRouteHandler()
)
);
如果我在视图中这样做
<%: Html.ActionLink("sl", "feedback-sl")%> | <%: Html.ActionLink("en", "feedback-en")%>
我的两个问题:
ActionLink扩展呈现链接到动作的锚元素。另一方面,Html.RouteLink扩展呈现一个锚元素,该锚元素可以解析为操作方法、文件、文件夹或其他资源。RouteLink并不像ActionLink那样采用ActionName和ControllerName字符串。从更详细的信息中,查看参数的参数名称。这里的描述不是很好地用MSDN/IntelliSense编写的
遗憾的是,对于第二个问题我没有答案。您能否与我们分享
namedTypeDroote
和multi-languageMVCrouteHandler
的实现?其中一个可能有问题。
<%: Html.RouteLink("sl", "feedback-sl")%> | <%: Html.RouteLink("en", "feedback-en")%>
"A route named 'feedback-sl' could not be found in the route collection.
Parameter name: name"