Create/Generate an absolute url in asp.net webapi

To get the absolute Url to an action or route in your WebAPI controller that points to another action, play around with the following code:

If the route is set to null, the first mapped route in the global.asax file will be used. You can play around with the parameters and anonymous object to get the correct routing you need.

For absolute url in mvc, see http://www.shawnmclean.com/blog/2011/07/creategenerate-an-absolute-url-in-asp-net-mvc-controller/