Get Local PC IP
This code is use to get the local pc ip address.
you can use this in window/web application too.
MessageBox.Show(GetLocalPCIP());
Function
protected string GetLocalPCIP()
{
string LocalIP = null;
System.Net.IPHostEntry IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName());
foreach (System.Net.IPAddress IPAddress in IPHostEntry.AddressList)
{
if (IPAddress.AddressFamily.ToString() == "InterNetwork")
{
LocalIP = IPAddress.ToString();
}
}
return LocalIP;
}
All the Best
:)
