API
Version 7.x > API > MVC route priority View modes: 
User avatar
Member
Member
ddj-datacon - 10/2/2012 3:12:07 AM
   
MVC route priority
Hi,

I'm trying to set up MVC Routing for my kentico project. The problem i'm having is that certains links aren't resolved as they should. For Instance i have a Homecontroller for displaying static content (About pages, Homepage, standard stuff).

I have the route registered as:

/Home/{*id}

This Url should be evaluated as /Home/Detail/{*id}. When the URL passes trough the routehandler it gets evaluated by the following route: /{controller}/{action}/. The Routing module then decides that my id is the action resulting in the following error:

[HttpException]: A public action method 'About' was not found on controller 'HomeController'.

In a normal situation i would change the order in the global.ascx.cs file to first evalute the more specific URL's before looking at the standard route /{controller}/{action}/. But because the Routes are registered through the Kentico CMSDesk this solution won't work.

Is it possible to define routing sequence or order trough the Kentico CMS. I know my problem could be resolved by changing my URL to /Home/Detail/{*id}, however i like to keep these URL's nice and clean.

Yours sincerely, Daan Doeze Jager

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 10/5/2012 9:40:30 AM
   
RE:MVC route priority
Hi,

This is an interesting request / question.
We haven't tested the ability to swap the processing order in this matter yet.
The current workaround is as you use with the URL including the Detail (action). Our developers will look into this after the weekend and we'll post an update then.

Thank you for your patience.

Regards,
Zdenek

User avatar
Guest
Yevgen Fesenko - 10/15/2012 4:22:50 PM
   
RE:MVC route priority
I'm having similar issues with route ordering.

Example alias table:
MVC:[Controller=BlogPoc]:[Action=Author]:/blog/author/{authorName}
MVC:[Controller=BlogPoc]:[Action=tag]:/blog/tag/{tagName}
MVC:[Controller=BlogPoc]:[Action=TagTest]:/blog/tags

I am unable to add a URL of type:
/blog/{year}
/blog/{year}/{month}

I suspect it is because they conflict with any URL of pattern /blog/[ANYTHING].

This should not occur.

By giving us a facility to reorder alias priority, we would be able make parametrized routes of lower priority. This would allow the router to fall-through the specific routes until it meets our own sequence of parametrized routes.

I see in the DB CMS_DocumentAlias there is already a field for priority (is 10 the highest priority or is 1?)

I think adding a robust and flexible routing table management would greatly benefit the maturity of Kentico's MVC implementation.

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 10/24/2012 9:49:59 PM
   
RE:MVC route priority
Hello,

Thanks for your feedback, it seems it could be really useful.

I have forwarded the info to the dev team so they can see what we can do about it.
When I have more info about the priorities of the DocumentAlias, I'll try to post an update.

Regards,
Zdenek

User avatar
Certified Developer 8
Certified Developer 8
cheryl.macdonald - 11/26/2013 8:39:59 AM
   
RE:MVC route priority
Has there been any update on this?

Thanks,

Cheryl

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 12/9/2013 3:12:25 PM
   
RE:MVC route priority
Cheryl,

The current plan to include route/alias priorities is still open in the longer term, but it will require more demand from Kentico CMS developers and users in order to be added in the next version. Hereby, I'd like to kindly ask you to add a feature requirement to the Kentico UserVoice page - I believe others will join, supporting the required attention.
Thank you in advance for your cooperation.

Kind regards,
Zdenek

User avatar
Guest
Yevgen Fesenko - 10/15/2012 4:24:27 PM
   
RE:MVC route priority
Adding route constraints (int, double, string, regex) would also be totally awesome

User avatar
Member
Member
kentico_sandroj - 12/1/2013 1:22:44 PM
   
RE:MVC route priority
Hello,

We will share the feedback with our developers but MVC support will be much improved in the next version.

Best Regards,
Sandro