This is a Perfect code to get the IP Address of the Current machine:
using System.Net;
Private string GetIP()
{
string strHostName = "";
strHostName = System.Net.Dns.GetHostName();
IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(strHostName);
IPAddress[] addr = ipEntry.AddressList;
return addr[addr.Length-1].ToString(); // if u work vs-2010 just change "lenght-2"
}
No comments:
Post a Comment