views:

1348

answers:

2

I am trying to come up with an approach to create "dynamic" routing. What I mean, exactly, is that I want to be able to assign the controller and action of a route for each hit rather than having it mapped directly.

For example, a route may look like this "path/{object}" and when that path is hit, a lookup is performed providing the appropriate controller / action to call.

I've tried discovering the mechanisms for creating a custom route handler, but the documentation / discoverability is a bit shady at the moment (I know, its beta - I wouldn't expect any more). Although, I'm not sure if thats even the best approach and perhaps a controller factory or even a default controller/action that performs all of the mappings may be the best route (no pun intended) to go.

Any advice would be appreciated.

+7  A: 

Please take a look at this little manual: MVC.Net Routing, section Option 3 - it describes how to build your custom request processing chain.

p.s. sorry for self-advertisement :)

maxnk
A: 

maxnk - thank you so much! That is exactly what I was looking for!

Chance
WTF? *Thanks* should be put as a comment to the answer that helped you not as a separate answer? How in the world did you not grasp the idea of Stackoverflow and get to 1k+ points?
Robert Koritnik
#Robert Koritnik Because this was one of my first posts and I wasn't allowed to comment, jackass
Chance
@Robert @Chance I don't think comments existed back then...
Will
@Chance: I apologise. Your explanation actually does explain it very well why you've put it as an answer. But even though (as you probably know by now) saying thanks on Stackoverflow is done by **accepting an answer**. I think this should be written somewhere in the FAQ, because there are newcomers popping up that still do the same thing. Or clarify their question within an answer instead of editing the question. So @Chance **I apologies for being rude to you.**
Robert Koritnik
@Robert No problem.
Chance