Я использовал этот метод:
private static string GetAbsoluteUrl(string relativeUrl)
{
var applicationUrl = String.Empty;
// remove ~
if (relativeUrl.StartsWith("~"))
{
applicationUrl = relativeUrl.Substring(1);
}
applicationUrl = (HttpContext.Current.Request.ApplicationPath + applicationUrl)
.Replace("//", "/");
var baseUrl = String.Format("{0}://{1}:{2}",
HttpContext.Current.Request.Url.Scheme,
HttpContext.Current.Request.Url.Host,
HttpContext.Current.Request.Url.Port);
return baseUrl + applicationUrl;
}