Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Casing of RouteData.Values affects finding of CurrentNode #381

Open
kimpenhaus opened this issue Feb 3, 2015 · 3 comments
Open

Casing of RouteData.Values affects finding of CurrentNode #381

kimpenhaus opened this issue Feb 3, 2015 · 3 comments

Comments

@kimpenhaus
Copy link

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.

2015-02-03_08-46-18

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.

2015-02-03_09-30-29

2015-02-03_09-17-28

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.

2015-02-03_09-26-06

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

@bounav
Copy link

bounav commented Jul 27, 2016

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.

@brgrz
Copy link

brgrz commented Aug 22, 2017

This doesn't seem fixed yet but it's pretty severe.

@maartenba
Copy link
Owner

PR is welcomed if you want to dig in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants