I have a page like http://localhost:55617/knowledge-house/magazines/ in umbraco 7. Now I want to apply routing to the same when parameters are present in url say http://localhost:55617/knowledge-house/magazines/English/2012/. where 'English' & '2012' are parameter.
So, in RouteConfig.cs I write following.
routes.MapRoute(
name: "/knowledge-house/magazines/",
url: "/umbraco/Surface/{controller}/{action}/{langid}/{year}/",
defaults: new { controller = "Kids", action = "Magazine", langid = UrlParameter.Optional, year = UrlParameter.Optional }
);
I have Kids Surface controller in which there is a code as follows.
public ActionResult Magazine(int langid = 0, string year = "")
{
return View("Magazine");
}
but for the url http://localhost:55617/knowledge-house/magazines/English/2012/ it gives error: HTTP Error 404.11 - Not Found
Actually I was checking incorrectly. As, urls are not nice urls. So I have to test with url like http://localhost:55617/knowledge-house/magazines?langid=English&year=2012 . This is now routing properly.