How is this achievable in asp.net mvc? I have seen some ruby examples out there…
i.e. nested folders, can be unlimited… however they are usually nested once
e.g.
lets say my main route in my app is:
/projects/{projectid}/
I am hooked into a file system, so I want users to navigate through whatever directory structure so I can have:
/projects/{projectid}/foldera/
/projects/{projectid}/folderb/
/projects/{projectid}/foldera/pic1.png
/projects/{projectid}/folderb/special/car134d.jpeg
etc…
This way I can only show files or pictures that are inside the url/directory the user is in…
I think what you’re after is the
{*queryvalues}segmented url handler for routing. The * indicates a wildcard-style match of one or more segments, delimited by a “/”.To map to a physical path, you can use this to add a route to your Global.asax.cs:
If you want to get the path into an MVC Controller Action and then do something with it, you could use MapRoute:
Then create a
ProjectController, and in theIndexaction retrieveRouteData.Values["projectId"]andRouteData.Values["path"]and do whatever you need to with them…