To get the end user's IP address, call this function.
protected string GetUserIPAddresss()
{
string ip = string.Empty;
if (Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null)
{
ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
}
else if (Request.UserHostAddress.Length != 0)
{
ip = Request.UserHostAddress;
}
else
{
ip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
}
return ip;
}
Thanks