You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to use MvcSitemapProvider together with T4MVC (and its extensions) and stumbled across a casing problem. That one is already mentioned on StackOverflow.
T4MVC is registering it's routes with capitalized keys.
The routing mechanism from ASP.NET MVC itself works fine with that precisely because the Microsoft documentation of the RouteValueDictionary reads:
Represents a case-insensitive collection of key/value pairs that you use in various places in the routing framework, such as when you define the default values for a route or when you generate a URL that is based on a route.
The MvcSiteMapProvider fails to set the CurrentNode - from what I can see in the sources - the MatchRoute function inside the RouteValueDictionary is comparing keys not case-sensitive.
There is a MergeRouteValuesAndNamedQueryStringValues function which is correcting the casing of the query string values but not those of the route values which leads to no matching in the MatchRoute function mentioned above.
One can have a discussion now, if all route values should be lower-cased by T4MVC or what the meaning of case-insensitive collection of key/value pairs from the MS documentation means. But I would like to see both systems (MVC and SiteMapProvider) behave the same way.
Thanks for taking your time! I really appreciate!
Cheers,
Marcus
The text was updated successfully, but these errors were encountered:
Thanks for reporting that case of the route values matter. This helped me get my breadcrumbs to work!
I would cast a vote to towards having the SiteMapProvider matching be case insensitive to closer match the behaviour described in the MS documentation.
I was trying to use MvcSitemapProvider together with T4MVC (and its extensions) and stumbled across a casing problem. That one is already mentioned on StackOverflow.
T4MVC is registering it's routes with capitalized keys.
The routing mechanism from ASP.NET MVC itself works fine with that precisely because the Microsoft documentation of the RouteValueDictionary reads:
The MvcSiteMapProvider fails to set the CurrentNode - from what I can see in the sources - the MatchRoute function inside the RouteValueDictionary is comparing keys not case-sensitive.
There is a MergeRouteValuesAndNamedQueryStringValues function which is correcting the casing of the query string values but not those of the route values which leads to no matching in the MatchRoute function mentioned above.
One can have a discussion now, if all route values should be lower-cased by T4MVC or what the meaning of case-insensitive collection of key/value pairs from the MS documentation means. But I would like to see both systems (MVC and SiteMapProvider) behave the same way.
Thanks for taking your time! I really appreciate!
Cheers,
Marcus
The text was updated successfully, but these errors were encountered: