After mapping http route:
var route = config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
The route.DataTokens is always null and it's not settalbe. So I can't do something like:
route.DataTokens.Add("key", "value");
The same scenario works in web api selfhost and MVC route.
The DataTokens is useful when you want to provide some additional data to the request. You can use the DataTokens property to retrieve or assign values associated with the route that are not used to determine whether a route matches a URL pattern. These values are passed to the route handler, where they can be used for processing the request.
var route = config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
The route.DataTokens is always null and it's not settalbe. So I can't do something like:
route.DataTokens.Add("key", "value");
The same scenario works in web api selfhost and MVC route.
The DataTokens is useful when you want to provide some additional data to the request. You can use the DataTokens property to retrieve or assign values associated with the route that are not used to determine whether a route matches a URL pattern. These values are passed to the route handler, where they can be used for processing the request.