what is the best way to get the base URL from a controller

asp.net-mvc

Solution

I use:

Request.Url.GetLeftPart(UriPartial.Authority);

Problem

Inside my controller how would i get the base URL. for example, if my url is: ``` http://www.mysite.com/MyController/MyAction ``` I want to have a function that returns : ``` http://www.mysite.com ```

Original source