public static string GetLocalIpAddress()
{
string hostName = Dns.GetHostName();
IPHostEntry ip = Dns.GetHostEntry(hostName);
string IpAddress = Convert.ToString(ip.AddressList[2]);
return IpAddress.ToString();
}
This will some times show Index out of bound exception what should be the problem in it.? thanks in advance