Possible Duplicate:
Get local ip address c#
Currently I am using following code for getting the ip addrress of each machine who have logged in my website. It is working fine if my website is in my intranet server.But if the same code is deployed at customer server and if I am accessing the site from my place using to customer application URL like (http://123.23.45.89/MyProd/App.htm)
, it is updating the ip addreress of my server address,not my local machine IP.
string IP4Address = String.Empty;
foreach (IPAddress IPA in Dns.GetHostAddresses(Request.ServerVariables["REMOTE_ADDR"].ToString())))
{
if (IPA.AddressFamily.ToString() == "InterNetwork")
{
IP4Address = IPA.ToString();
break;
}
}
if (IP4Address != String.Empty)
{
return IP4Address;
}
foreach (IPAddress IPA in Dns.GetHostAddresses(Dns.GetHostName()))
{
if (IPA.AddressFamily.ToString() == "InterNetwork")
{
IP4Address = IPA.ToString();
break;
}
}
return IP4Address;
If there is any other way to find the ip address for individual PC.(like finding the local ip addess from any machine through out internet Network)