File details
Matched /files/{name}.{ext?} - a complex segment with an optional extension.
- name
- report
- ext
- (null - the optional part was omitted)
How complex segments match
The segment text is scanned right-to-left: the router finds the rightmost
., gives what follows to {ext?} and the rest to {name} -
so a.b.c binds name = "a.b", ext = "c". Every parameter
in a complex segment must capture at least one character, and the optional last part may only
follow a period: report. (trailing dot, nothing after) never matches.
@* report.pdf → name = "report", ext = "pdf" report → name = "report", ext = null (optional part + '.' dropped together) a.b.c → name = "a.b", ext = "c" report. → no match *@ <Broute Path="/files/{name}.{ext?}" Component="@typeof(FileDetailPage)" /> @* Only a period may precede the optional part - {name}-{ext?} throws at parse time. Any literal works for REQUIRED parts though, and parts can be typed: *@ <Broute Path="/api/v{major:int}-{minor:int}" ... />