Oh my lord, assuming you have the URL (or URI) stored somewhere.
Or you can use these convenient functions:
Code:
var originalUrl = new Uri("http://example.org/454/history");
var relativePath = "images/hello.png";
var imgUrl = originalUrll.GetLeftPart(UriPartial.Authority) + "/" + relativePath;
Or you can use these convenient functions:
Code:
// GetAbsoluteUrlFromRelative("http://example.org/454/history", "images/hello.png");
private static string GetAbsoluteUrlFromRelative(Uri uri, string relativePath)
{
return uri.GetLeftPart(UriPartial.Authority) + "/" + relativePath;
}
private static string GetAbsoluteUrlFromRelative(string url, string relativePath)
{
return GetAbsolutePathFromRelative(new Uri(url));
}
A casual conversation between barata and I about Nukem.