I am working on a Legacy ASP.NET system. I say "legacy" because there are NO tests about 90% of the system. I am trying to fix the routes in this project, and I am having a problem that I want to solve using shared routes.
I have the following routes:
routes.MapRoute(
"DefaultWithPdn",
"{controller}/{action}/{pdn}",
new { controller = "", action = "Index", pdn = "" },
null
);
routes.MapRoute(
"DefaultWithClientId",
"{controller}/{action}/{clientId}",
new { controller = "", action = "index", clientid = "" },
null
);
The problem is that the first route captures all the traffic for what I need to redirect to the second route. The route is shared (no controller is defined in the restriction in determining the route), since several controllers throughout the application use the same prerequisite (sometimes we need "pdn", sometimes we need "clientId").
, , ? ? ( , ).
(AFAIK) :
, : (foo | bar | biz | bang) : (home | customer | products) . , :
~/Foo/Home/123// "DefaultwithPdn"
~/Foo//abc// "DefaultWithClientId"
, Foo Controller , pdn , clientId ( ), .
/ , , , , .
? , ?