Part of my application maps resources stored in a number of locations onto web URLs like this:
The resources location is modelled after file paths and as a result there can be an unlimited level of nesting. Is it possible to construct an MVC route that matches this so that I get the path in its entirety passed into my controller? Either as a single string or possibly as an params style array of strings.
I guess this requires a match on the files keyword, followed by some sort of wildcard. Though I have no idea if MVC supports this.
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
A route like
will get the path as a single string. The
*designates it as a wildcard mapping and it will consume the whole URL after
For more information on ASP.NET’s Routing feature, please see MSDN:
And for the “catch-all” parameters you want to use, see the section under “Handling a Variable Number of Segments”.