using System.Text; public class UrlPath { public static string Combine(params string[] items) { var sb = new StringBuilder(); foreach (var item in items) { if (sb.Length > 0 && !sb.ToString().EndsWith("/")) sb.Append("/"); if (sb.Length > 0 && item.StartsWith("/")) sb.Append(item.Substring(1)); else sb.Append(item); } return sb.ToString(); } }