I have a web application that has a login. Now what I want is to get the IP address of that end user upon login. I've tried researching but based on what I understood, it gets the ip of my machine not the person that logins. This app is already deployed on a server. And if I do what they said, I will be getting the server's ip address. But I want the IP address of the end user that logs in.
This is a sample of what I've seen.
private string GetIP()
{
string strHostName = "";
strHostName = System.Net.Dns.GetHostName();
IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(strHostName);
string ipaddress =convert.tostring(ipEntry.AddressList[2]);
return ipaddress.tostring();
}
I'm not sure if I understood this correctly but I think this will get local ip address, not the ip address of the end user that is logging in. Please do correct me if I'm wrong. Any ideas? Thanks!