try { //iphostname = Dns.GetHostName(); // Resolving Host name IPHostEntry ipentry = Dns.GetHostEntry(hostLabel.Text); IPAddress[] addr = ipentry.AddressList;// Resolving IP Addresses for (int i = 0; i < addr.Length; i++) { try { ipLabel.Text= Convert.ToString(addr[i]) + "\r\n"; } catch { ipLabel.Text += "IP Address | " + "\r\n"; } } } catch { | " + "\r\n"; } }
string strHostName = ""; strHostName = System.Net.Dns.GetHostName(); IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(strHostName); IPAddress[] addr = ipEntry.AddressList; ipLabel.Text = addr[addr.Length - 2].ToString();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)