A โdynamicโ route is not a problem. Just use a wildcard:
config.Routes.MapHttpRoute( name: "NavApi", routeTemplate: "api/my/{*id}", defaults: new { controller = "my" } );
This route must be added to the default value.
The problem is that you want to complete the URL with a file extension. It will be interpreted as a static request in a .txt file. In IIS7 +, you can get around this by adding a line to web.config:
<system.webServer> <modules runAllManagedModulesForAllRequests="true" />
Do not forget that if you use MyController , then the route segment is simply โmineโ
Nenad source share