Alex Rivera | Logout

ASP.NET MVC routes

Asked 2008-11-10T00:37:17.930
11

I need help with this route map

routes.MapRoute("Blog_Archive", 
                "Blog/Archive/{year}/{month}/{day}",
                new { 
                      controller = "Blog",
                      action = "archive",
                      year = "",
                      month = "",
                      day = "",
                      page = 0
                    });

When I call http://localhost:5060/blog/Archive/2008/11, it picks up the year and month and sends it to the controller. But when I try http://localhost:5060/blog/Archive/2008
it sends it to the controller but the year parameter is null and so are all the other parameters.

Edit
Report

1 Answer

11

Do you have any other Route for Blog/Archive/{something}?

Use the Routing Debugger to see which route actually gets hit, most likely it's not hitting that route.

answered 2008-11-10T00:40:05.163

Your Answer