views:

248

answers:

1

I was wondering if you could show me all the various ways to declare routes in ASP.NET MVC (1 and 2). Please explain each method of defining a route, how it is used, and what case it covers.

Here is an example of what I am hoping to collect here:

routes.MapRoute("Directors",
    "Directors/{filter}/{skip}",
    new { controller = "Directors", action = "Index", skip = 0, filter = "" },
    new { skip = @"\d+", filter = @"^[a-zA-Z]+.+" });

Directors = the name of the route. Directors/{filter}/{skip} = the url definition. new { controller = "Directors", action = "Index", skip = 0, filter = "" } = the default for this route. new { skip = @"\d+", filter = @"^[a-zA-Z]+.+" } = the constraints for this route.

+3  A: 

My first port of call would be the ASP.NET learning pages on routing.

I think this may also be a good use of the Community Wiki feature, as the question you're asking a pretty vague question where there is nor real answers, just good documentation on routes.

Dan Atkinson