=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Below is the method which will return the IP address of the system as a string.
" strHostName " is a variable as you can see below which contains the Host name (PC name) that also you can get.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
public string GetNetInfo()
{
try
{
string retVal = string.Empty;
string strHostName = System.Net.Dns.GetHostName();
string strIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
return strIp;
}
catch (Exception ex)
{
throw ex;
}
}
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Enjoy......
Below is the method which will return the IP address of the system as a string.
" strHostName " is a variable as you can see below which contains the Host name (PC name) that also you can get.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
public string GetNetInfo()
{
try
{
string retVal = string.Empty;
string strHostName = System.Net.Dns.GetHostName();
string strIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
return strIp;
}
catch (Exception ex)
{
throw ex;
}
}
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Enjoy......