Loganathan s

Loganathan s

  • NA
  • 12
  • 1.4k

How to remote ip address of my machine?

Oct 5 2013 2:24 AM
string ipList = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
            if (!string.IsNullOrEmpty(ipList))
            {
                return ipList.Split(',')[0];
            }
            return Request.ServerVariables["REMOTE_ADDR"];
i am using above code. but its returns localhost address like 127.0.0.1. how can i use this code

Answers (2)