public static string CombineUrls(params string[] urls)
{
string result = string.Empty;
if (urls.Length == 0)
{
return string.Empty;
}
if (urls.Length == 1)
{
return ReplacePathSlashesByUrlSlashes(urls[0]);
}
// Store first path (remove trailing slashes only since we want to support root urls)
result = RemoveTrailingSlashes(urls[0]);
for (int i = 1; i < urls.Length; i++)
{
if (!string.IsNullOrEmpty(urls[i]))
{
result = RemoveTrailingSlashes(result);
string tempPath = RemoveStartAndTrailingSlashes(urls[i]);
result = Combine(result, tempPath);
}
}
return ReplacePathSlashesByUrlSlashes(result);
}
#endif