Get IP Address Of A System using c# :
The following just two line code useful for Get IP Address Of A Machine.
// Get the hostname
string yourHost = System.Net.Dns.GetHostName();
// Show the hostname
lblMyhost.Text = yourHost;
// Get the IP from the host name
string yourIP = System.Net.Dns.GetHostEntry(yourHost).AddressList[0].ToString();
// Show the IP
lblIPAddress.Text = yourIP;
The following just two line code useful for Get IP Address Of A Machine.
// Get the hostname
string yourHost = System.Net.Dns.GetHostName();
// Show the hostname
lblMyhost.Text = yourHost;
// Get the IP from the host name
string yourIP = System.Net.Dns.GetHostEntry(yourHost).AddressList[0].ToString();
// Show the IP
lblIPAddress.Text = yourIP;
0 comments
Post a Comment