I am trying to enable a route like the following
route = new Route("{w1}-{c1}-{n1},{w2}-{c2}-{n2}", new ResultRouteHandler());
route.Constraints = new RouteValueDictionary();
route.Constraints.Add("c1", "(.*)|([-])");
route.Constraints.Add("c2", "(.*)|([-])");
RouteTable.Routes.Add(route);
However I run into a problem when c1 or c2 is "-". For example "a-b-c,d---f" returns 404 (whilst "a-b-c,d-e-f" works fine). Anyone has a clue what am I doing wrong? Thank you in advance.
EDIT:
I found a simple workaround for this problem:
route = new Route("{w1}-{c1}-{n1},{w2}---{n2}", new MyRouteHandler());
RouteTable.Routes.Add(route);
route = new Route("{w1}-{c1}-{n1},{w2}-{c2}-{n2}", new MyRouteHandler());
RouteTable.Routes.Add(route);
If c2 is "-" we match to the first route, otherwise to the second.