With some input from an associate (who suggested I use Url.GetLeftPart), I came up with the following solution:
string fullyQualifiedUrl = GetFullyQualifiedUrl("~/Home");
{
HttpRequest request = HttpContext.Current.Request;
string urlLeftPart = request.Url.GetLeftPart(UriPartial.Authority);
string appPath = request.ApplicationPath;
string fullyQualifiedUrl = string.Format("{0}{1}{2}", urlLeftPart, appPath, virtualPath).Replace("~/", "");
return fullyQualifiedUrl;
}
Share & Enjoy!
No comments:
Post a Comment