Skip to main content

WebAPI Wildcard In Route

·1 min

I recently discovered that it’s possible to include a wildcard (the * character) in a WebApi route. It looks something like:


This ASP.Net article has a good example (search for the ‘wildcard’ section).

Essentially, everything beyond the route/ part of the url will be assigned to the key variable. For example, the route


results in

key = "more/parts/here?param=1";

This can be useful for things like file storage and other uri params that may include folder paths or similar.