IP Adres Bulma

public string IP()
{
  string ip = ""
  if (HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null)
  {
      ip = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
      if (!string.IsNullOrEmpty(ip))
      {
          string[] ipRange = ip.Split(",".ToCharArray());
          ip = ipRange[0];
      }
  }
  if (string.IsNullOrEmpty(ip))
      if (HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"] != null)
          ip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
  ip = ip.Trim();
  return ip;
}

 

Bunlar da hoşunuza gidebilir...