asp.net-mvc-routing

Multiple levels in MVC custom routing

本小妞迷上赌 提交于 2019-11-25 22:00:12
问题 I am trying to build my own little cms. I created an abstract pageBase class that is inherited by Static, Reviews, Articles, News. Each having there own controller methods. My problem is that I need to allow the admin to define his own custom path levels. E.g. news\\local\\mynewdog or Articles\\events\\conventions\\mycon . So I would like a way to pass an array of strings and also set the custom routing. 回答1: You can make CMS-style routes seamlessly with a custom RouteBase subclass. public

ASP.NET MVC 5 culture in route and url

一曲冷凌霜 提交于 2019-11-25 21:55:49
问题 I\'ve translated my mvc website, which is working great. If I select another language (Dutch or English) the content gets translated. This works because I set the culture in the session. Now I want to show the selected culture(=culture) in the url. If it is the default language it should not be showed in the url, only if it is not the default language it should show it in the url. e.g.: For default culture (dutch): site.com/foo site.com/foo/bar site.com/foo/bar/5 For non-default culture