Reputation: 6971
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?
Upvotes: 0
Views: 231
Reputation: 142242
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.
Upvotes: 1