routing with multiple parameter in umbraco 7

520 views Asked by At

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

1

There are 1 answers

0
ghetal On BEST ANSWER

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.