Get IP Address of Client and Server Sytem

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);
}
}

Code To Get the IP Address of Client's Machine:
Request.UserHostAddress.ToString()

0 comments: