In my Global.asax file I have the following;
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Account", action = "LogOn", id = UrlParameter.Optional }); // Parameter defaults
routes.MapRoute(
"Contracts",
"Contract/{contractId}",
new { controller = "Contract", action = "Details" }
);
I want to specify a route Contract/10 where 10 is the contractId which is the parameter for the Detail method in my ContractController. So this works; http://localhost:1234/Contract/Details?contractId=10 But not http://localhost:1234/Contract/10
What am I doing wrong?