A route default supplies a value for a segment variable when the URL omits that segment. Write it inside the route pattern with an equals sign: `capital/{country=France}`. This lets the route match both `/capital` and `/capital/uk`. section 13.2.2
Check the matched URLs
With `app.MapGet("capital/{country=France}", Capital.Endpoint)`, `/capital` sets `country` to `France`; `/capital/uk` sets it to `uk`. `/capital/europe/italy` still has too many segments to match. Restart ASP.NET Core and request `http://localhost:5000/capital` to check the fallback. section 13.2.2
Don’t confuse a route default with the value model binding supplies when it cannot find request data. An action parameter of type `long` can receive `0` even without a matching route value, query string, or form value. If that becomes a database key, handle the missing match rather than assuming the query will succeed. section 28.3.2
Table 13.6 Matching URLs (view table figure)
| URL Path |
Description |
|---|---|
| / |
No match—too few segments |
| /city |
No match—first segment isn’t capital |
| /capital |
Matches, country variable is France |
| /capital/uk |
Matches, country variable is uk |
| /capital/europe/italy |
No match—too many segments |
The URL table shows exactly which paths the defaulted route matches—and which it does not. section 13.2.2



















