Current Page url: http://localhost:60602/index.aspx
string hostURL = HttpContext.Current.Request.Url.AbsoluteUri.Replace(HttpContext.Current.
Request.Url.AbsolutePath, "");
Request.Url.AbsolutePath, "");
Output: http://localhost:60602
Get root url from WCF Service:
string rootURL = OperationContext.Current.Channel.LocalAddress.Uri.AbsoluteUri.
Replace(OperationContext.Current.Channel.LocalAddress.Uri.AbsolutePath, "");
Replace(OperationContext.Current.Channel.LocalAddress.Uri.AbsolutePath, "");