I want to define a route that have 2 optional parameters in the middle of the URL the start an end parameters are 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 diferent approaches and none of them worked, i could use some of your help.
Thanks in advance.
EDIT
I manage to solve the problem this way, but it's 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"
}
);