In my recent project I was told to keep track of the IP address of all the visitors. Here I will show you how to get IP address of the client machine in csharp in asp.net.
There are many ways you can get the IP address of a client machine.
string strDNS = Dns.GetHostName();
string strClientIP = HttpWorkerRequest.GetRemoteAddress().ToString();
3. If you are calling from web service use code below
string strClientIP = Context.Request.ServerVariables ["REMOTE_ADDR"]
string host = Dns.GetHostName();
IPHostEntry ip = Dns.GetHostEntry(host);
string strClientIP = ip.AddressList.ToString());