Get IP Address of Client and Server Sytem

Lakhangarg
Posted by Lakhangarg under ASP.NET category on | Views : 2542
Code To Get the IP Address of Client's Machine:
Request.UserHostAddress.ToString()

Code To Get the IP Address of Host:
private void GetHostaddress()
{
string strHostName = Dns.GetHostName();
IPAddress[] ips;
ips = Dns.GetHostAddresses(strHostName);
foreach (IPAddress ip in ips)
{
Response.Write(ip);
}
}


Thanks & Regards
Lakhan Pal Garg

Comments or Responses

Login to post response