I've just downloaded the BotLab code from the Rock,Paper,Azure site and am toying with it, but am unable to get one of the routes to work. Here they are:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("favicon.ico");
routes.MapRoute(
"GameLog",
"GameLog/{teamName}.vs.{otherTeamName}",
new { controller = "GameLog", action = "Index" }
);
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action开发者_C百科 = "Index", id = "" }
);
routes.MapRoute(
"None",
"",
new { controller = "Home", action = "Index", id = "" }
);
}
If I try to navigate to the ~/GameLog/Something.vs.SomethingElse
url, I get a 404. If I go to the ~/GameLog/
url, it hits the default route. I don't really understand why the first route wouldn't match ~/GameLog/Something.vs.SomethingElse
.
So, just for compliance with Jeopardy rules, why doesn't the first route work as expected?
Turns out my first route never matched because I was running MVC 2 and should have been running MVC 3. Once I installed MVC 3 and the updated VS tools, it worked as expected.
精彩评论