I'm working in Umbraco 9 and have a need to utilize MVC Route Attributes. Here's my scenario...
I'm creating a multi level listing of custom data (custom sql data). I want the author to be able to control the initial alias/slug, but everything after that will be dynamic. So for example... lets say they set the alias to /mylisting/, if the user goes to that page, it'll get picked up and show the first level of data (pull from SQL). Then that listing would have links that point back to itself but with an extra slug in the URL (i.e. /mylisting/somename/). Rather than requiring the author to enter a page for every item in that database, this can just be dynamic where it could hit my controller for /mylisting/ and I could have a custom route attribute for "somename" which can provide a different view/output.
I'm looking around at the baseController and RenderController, but those seem to just accept "Index" (which covers /mylisting/), but I'm unclear how to accept the remaining levels.
This could go several layers deep (/mylisting/somegroup/someperson).
Has anyone else done this? I thought I could just add a custom mapping, but the RenderController doesn't seem to respect it.
Route Hijacking and Custom Route Attributes
Hi all,
I'm working in Umbraco 9 and have a need to utilize MVC Route Attributes. Here's my scenario...
I'm creating a multi level listing of custom data (custom sql data). I want the author to be able to control the initial alias/slug, but everything after that will be dynamic. So for example... lets say they set the alias to /mylisting/, if the user goes to that page, it'll get picked up and show the first level of data (pull from SQL). Then that listing would have links that point back to itself but with an extra slug in the URL (i.e. /mylisting/somename/). Rather than requiring the author to enter a page for every item in that database, this can just be dynamic where it could hit my controller for /mylisting/ and I could have a custom route attribute for "somename" which can provide a different view/output.
I'm looking around at the baseController and RenderController, but those seem to just accept "Index" (which covers /mylisting/), but I'm unclear how to accept the remaining levels.
This could go several layers deep (/mylisting/somegroup/someperson).
Has anyone else done this? I thought I could just add a custom mapping, but the RenderController doesn't seem to respect it.
Thanks!
is working on a reply...