0

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 });
1
  • 3
    Shouldn't the URL be http://localhost:22220/groups/go/1234/2525/Bob to match your route? Commented May 23, 2011 at 22:22

2 Answers 2

2

The link needs to be : http://localhost:22220/groups/go/1234/2525/Bob

Or you could change the route to "groups/go/{groupId}/{userId}"

Sign up to request clarification or add additional context in comments.

Comments

0

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?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.