i am trying to generate a url for a resource using asp.net web api. I can do that pretty easily in side ApiController, but what about I am not in the ApiController context?
1 Answer
The long way is to get the request, dig out the Configuration and the RouteData from the properties collection, create yourself a ControllerContext and then you can use UrlHelper to general Urls.
There may be an easier way, but I haven't found it yet.
1 Comment
Eatdoku
yeah it'll be nice if the UrlHelper can be injected without manually construct the context~