Asp.NET MVC 2路由

Asp.NET MVC 2路由,asp.net,asp.net-mvc,asp.net-mvc-routing,Asp.net,Asp.net Mvc,Asp.net Mvc Routing,我想定义一个路由,该路由在URL的中间有2个可选参数,开始和结束参数都是数字 routes.MapRoute( "", "Source/Changeset/{start}/{end}/{*path}", new { controller = "Source", action = "Changeset",

我想定义一个路由,该路由在URL的中间2个可选参数开始结束参数都是数字

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+" }
                );
我尝试了不同的方法,但都不奏效,我需要你的帮助

提前谢谢

编辑

我设法用这种方法解决了这个问题,但它一点也不优雅。
您需要为所有可能的组合创建路线,这可能会有点毛茸茸的:

//route if everything is included
routes.MapRoute(null, ""Source/Changeset/{start}/{end}/{*path}",
    new { controller = "Home", action = "Index" }
);

//route if nothing is included
routes.MapRoute(null, ""Source/Changeset/{*path}",
    new { controller = "Home", action = "Index", start=0, end=5 } //defaults
);

//and so on...

但是,这里也有一个问题:由于开始和结束都是数字,因此无法(因为它们是可选的)确定源/变更集/2/fodass中的“2”是开始还是结束变量,因此您可能必须想出一种新的方法,或者将您的方法更改为类似源/变更集/start/2/fodassSource/Changeset/End/5/fodassSource/Changeset/Start/2/End/5/fodass,等等。

如果存在一个值,它就是开始,因此无需这样做。谢谢你的帮助。
//route if everything is included
routes.MapRoute(null, ""Source/Changeset/{start}/{end}/{*path}",
    new { controller = "Home", action = "Index" }
);

//route if nothing is included
routes.MapRoute(null, ""Source/Changeset/{*path}",
    new { controller = "Home", action = "Index", start=0, end=5 } //defaults
);

//and so on...