asp.net web api - Web API get route values -
is there way statically route values service method (outside of controller) running in web api context? example, can following in asp.net mvc:
var mvchandler = httpcontext.current.handler mvchandler; var routevalues = mvchandler.requestcontext.routedata.values;
i'd find equivalent version of code web api.
when try debug sample web api request , @ httpcontext.current.handler
of type httpcontrollerhandler
, type doesn't have properties access route data.
edit
to try provide more information. code trying read value inside of factory class have builds custom object application.
you can use getroutedata() extension on httprequestmessage. need include system.net.http namespace this.
system.web.http.routing.ihttproutedata routedata = request.getroutedata();
Comments
Post a Comment