I want to define a route with 2 optional parameters in the middle of the URL start end - digits
routes.MapRoute( "", "Source/Changeset/{start}/{end}/{*path}", new { controller = "Source", action = "Changeset", start = UrlParameter.Optional, end = UrlParameter.Optional, path = "crl" }, new { start = @"\d+", end = @"\d+" } );
I tried different approaches and none of them worked, I could use some help.
Thanks in advance.
EDIT
I manage to solve the problem this way, but it is far from elegant.
routes.MapRoute( "", "Source/Changeset/{start}/{end}/{*path}", new { controller = "Source", action = "Changeset", start = UrlParameter.Optional, end = UrlParameter.Optional, path = "crl" }, new { start = @"\d+", end = @"\d+" } ); routes.MapRoute( "", "Source/Changeset/{start}/{*path}", new { controller = "Source", action = "Changeset", start = UrlParameter.Optional, path = "crl" }, new { start = @"\d+" } ); routes.MapRoute( "", "Source/Changeset/{*path}", new { controller = "Source", action = "Changeset", path = "crl" } );
source share