O'Reilly logo

Applied ASP.NET 4 in Context by Adam Freeman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with Routes

At the heart of the ASP.NET routing feature is the idea of a URL pattern. When a URL is requested, the routing feature compares a list of patterns that you have provided and tries to match one of them to what has been requested. Here is an example of a routing URL:

/App/{page}/Action/{name}

URL patterns work on segments of a URL. A segment is a section of a URL delimited by the / character. Each segment in a pattern is represented by a literal value or a variable. Variables are expressed using braces ({ and }). In the previous pattern, there are four segments; two of the segments are literal (App and Action), and two are variables (page and name).

For a URL to match a URL pattern, there must be the same number of segments ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required