This is a demonstration of how to inject an IRouter in between traditional routes and MVC's handler. This allows you to accomplish a variety of things that were possible with WebAPIs handlers, but inside the routing system. The example here turns a header representing the user into a locale, which is used to select a controller. You could do other things like reject the route match or change link generation. There is one subtle project change here, to allow the same to be possible for attribute routing, we need to create the attribute route after running the user's routing configuration code. |
||
|---|---|---|
| .. | ||
| Canada | ||
| Spain | ||
| US | ||
| CustomRoute_OrdersControlller.cs | ||