I am running an ASP.NET application. The web server is located on the same system. In the code behind I just want to get the IP address of the requesting client. I am using this code:
Request.UserHostAddress
But I am getting a wrong address: 127.0.0.1. My system IP address is 198.162.0.27.
You are getting the right one.
127.0.0.1is the loopback IP address, which is mapped in yourhostsfile to localhost.If you connect from a remote computer, you will get the remote computers network address.