public static string StripPortFromHost(string host) { if (String.IsNullOrEmpty(host)) throw new ArgumentException("Cannot strip the port from a null host", "host"); return Regex.Replace(host, @":.*$", string.Empty); }