What Controller/Action will this go to?

Posted by rkrauter on Stack Overflow See other posts from Stack Overflow or by rkrauter
Published on 2010-04-25T16:24:16Z Indexed on 2010/04/25 16:53 UTC
Read the original article Hit count: 267

Assume this is the first route entry:

routes.MapRoute(
  "myRoute",
  "employees/{city}/{pageNumber}",
  new { controller="Employees", action = "List", pageNumber = 1 }
);

If I make the following request

employees/london/2

it gets matched to the following action method:

public ActionResult List(string city) {}

How did that happen? I did not specify "city" in my object defaults:

new { controller="Employees", action = "List", pageNumber = 1 } 

Please explain. Thanks!

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about ASP.NET