How to get base URL in Web API controller?
I know that I can use Url.Link() to get URL of a specific route, but how can I get Web API base URL in Web API controller? Kiran Challa You could use VirtualPathRoot property from HttpRequestContext ( request.GetRequestContext().VirtualPathRoot ) In the action method of the request to the url " http://localhost:85458/api/ctrl/ " var baseUrl = Request.RequestUri.GetLeftPart(UriPartial.Authority) ; this will get you http://localhost:85458 Url.Content("~/") worked for me! This is what I use: Uri baseUri = new Uri(Request.RequestUri.AbsoluteUri.Replace(Request.RequestUri.PathAndQuery, String.Empty