Reputation: 49
Can someone please tell me why, with a url like this...
http://localhost:22220/groups/go/1234/2525?name=Bob
This route mapping doesn't match...
routes.MapRoute(null, // Route name
"groups/go/{groupId}/{userId}/{name}",
new { controller = "Groups", action = "Go" });
But this route mapping appears to match? (Using Phil Haack's Route Tester, this is the 'Generated URL')...
context.MapRoute("Teams_Default",
"Teams/{controller}/{action}/{id}",
new { id = UrlParameter.Optional });
Upvotes: 0
Views: 223
Reputation: 1003
The link needs to be : http://localhost:22220/groups/go/1234/2525/Bob
Or you could change the route to "groups/go/{groupId}/{userId}"
Upvotes: 2
Reputation: 4753
Since the last 'name' parameter is not formed correctly on that URL, the first route doesn't get matched. If you change the route to this:
routes.MapRoute(null, // Route name
"groups/go/{groupId}/{userId}/{name}",
new { controller = "Groups", action = "Go", name = "Bob" });
it will work because of the default value for 'name'.
Obviously, this is no good for you since you want the name to be read.
I think the bigger question is: How is that URL being generated?
Upvotes: 0