I don\'t understand what\'s the deal behind this, why is it so easy to get route values inside Request
of controller but nearly impossible to do the same thing on <
Try the code below to get the route data:
var routeValues = Request.GetRouteData().Values["MS_SubRoutes"];
Note:
The type of Request is System.Net.Http.HttpRequestMessage
. It is a property of class System.Web.Http.ApiController
, or you can get it from eleswhere.
GetRouteData is an extension method in class System.Net.Http.HttpRequestMessageExtensions
.