c# - How to define a route to match 3 parameters, when I'm only interested in the third? -
i'm trying specify route configuration allow url similar to:
/{any sequence of characters}/{any sequence of characters}/{mexid}   we're redesigning old system used urls of previous format. our new system has catch these requests , redirect them new url, if there 3 url parameters. it's third parameter i'm interested in.
this route mapping i'm using:
routes.maproute(     null,     "{param1}/{param2}/{mexid}",     new { controller = "shareclass", action = "fundfactsheet", mexid = "" } );   the problem i'm having acting kind of catch-all invalid requests come in, interested in being route urls mexid in them.
how can define route apply urls contain 3 parameters, if url doesn't match route i've more defined?
you might want add route constraint (i haven't tested yet think should answer question)
routes.maproute(     null,     "{param1}/{param2}/{mexid}",     new { controller = "shareclass", action = "fundfactsheet" },     new { param1 = @".+", param2 = @".+", mexid = @".+" } );      
Comments
Post a Comment