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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -