Using the bellow code .
protected string GetUserIP()
{
string strUserIP = string.Empty;
if (HttpContext.Current.Request.ServerVariables[\"HTTP_X_FORW
To get the IpAddress use the below code
string IPAddress = GetIPAddress();
public string GetIPAddress()
{
IPHostEntry Host = default(IPHostEntry);
string Hostname = null;
Hostname = System.Environment.MachineName;
Host = Dns.GetHostEntry(Hostname);
foreach (IPAddress IP in Host.AddressList) {
if (IP.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) {
IPAddress = Convert.ToString(IP);
}
}
return IPAddress;
}
Source