我跟着this指南,它適用於我的語言支持。網址如 http://domain.com:33982/en-us/Test效果很好。ASP.Net MVC 5路由與文化的網址
但是,我的問題是,我希望它與 http://domain.com:33982/Test以及。我無法弄清楚如何路由它沒有文化的鏈接... 我在RouteConfig.cs路線
routes.MapRoute(
name: "Default",
url: "{culture}/{controller}/{action}/{id}",
defaults: new { culture = CultureHelper.GetDefaultCulture(), controller = "Home", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "MissingCulture",
url: "{controller}/{action}/{id}",
defaults: new { culture = CultureHelper.GetDefaultCulture(), controller = "Test", action = "PageMissing", id = UrlParameter.Optional }
);
我真的不明白爲什麼它不工作。當我去/測試只是將我重定向到默認主頁/索引。
有什麼建議嗎?謝謝
如果你不設置文化違約的默認路由嗎? –
請參閱[ASP.NET MVC 5在路由和URL中的文化](http://stackoverflow.com/a/32839796/181087) – NightOwl888