Skip to content

Assets browser

Matched /assets/{*path:nonfile} - a catch-all with a constraint.

path
(empty - the catch-all matched zero segments)

Constraints on catch-alls

The constraint sees the whole remainder ("img/logo", slashes and all) and the bound value always stays a string - typed conversion deliberately skips catch-alls, mirroring the built-in router. nonfile checks only the text after the last slash, so directory paths pass while app.js is rejected. On the empty remainder (/assets itself) the constraint sees a missing value: nonfile accepts that, any other constraint would not ({*path:int} wouldn't match /assets).

@* /assets          → path = ""          (missing value: nonfile accepts)
   /assets/img/logo → path = "img/logo"  ("logo" is not a file name)
   /assets/app.js   → no match           ("app.js" IS a file name) *@
<Broute Path="/assets/{*path:nonfile}" Component="@typeof(AssetsPage)" />