public static string CombinePathsUri(params string[] PathParts) { return(PathParts.SelectMany(s => s.Split(new[] { "\\", "/", " " }, StringSplitOptions.RemoveEmptyEntries)) .Aggregate("/", (a, b) => a == "/" ? $"{a}{b}" : $"{a}/{b}")); }