2
Answers

How to remote ip address of my machine?

Loganathan s

Loganathan s

11y
1k
1
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)