2
Reply

How to remote ip address of my machine?

Loganathan s

Loganathan s

Oct 5 2013 2:24 AM
985
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)