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

Area route with "area" in defaults throws exception #41

Closed
tibimunteanu opened this issue Aug 27, 2015 · 3 comments
Closed

Area route with "area" in defaults throws exception #41

tibimunteanu opened this issue Aug 27, 2015 · 3 comments
Labels

Comments

@tibimunteanu
Copy link

My app routing works with no problems before adding RouteJs.
When I install RouteJs, the app crashes in the layout where I reference the script with src="@RouteJs.RouteJsHandler.HandlerUrl". The exception is "an item with the same key has already been added"

@tibimunteanu
Copy link
Author

forgot to mention that i use MVC4

@tibimunteanu
Copy link
Author

found the problem. if you use areas and register routes in a specific area and enter the default area in defaults for a specific route even though you implemented the AreaName getter, MVC will not break but RouteJs will.

So if a route in an area is like this: context.MapRoute("routeName", "route/url/here", new { area = "areaName", controller = "controllerName", action = "actionName" }); RouteJs will break with the exception i mentioned. If you remove the area = "areaName" part works.

@Daniel15
Copy link
Owner

Ah, good catch. I think this probably shouldn't throw an exception. I'll reopen the task to remind myself to handle this better.

@Daniel15 Daniel15 reopened this Aug 28, 2015
@Daniel15 Daniel15 added the bug label Aug 28, 2015
@Daniel15 Daniel15 changed the title A key was already added Area route with "area" in defaults throws exception Aug 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants