public static string ServerURI(string uri) { // Get rid of eventual slashes at the end try { if (uri.EndsWith("/")) { uri = uri.Substring(0, uri.Length - 1); } } catch { } IPAddress ipaddr1 = null; string port1 = ""; try { ipaddr1 = Util.GetHostFromURL(uri); } catch { } try { port1 = uri.Split(new char[] { ':' })[2]; } catch { } // We tried our best to convert the domain names to IP addresses return((ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri); }