I get the wrong client IP

I am running an ASP.NET application. The web server is 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 get the wrong address: 127.0.0.1. My system IP address 198.162.0.27.

+2
source share
1 answer

You get the right one. 127.0.0.1is the loopback IP address that is displayed in your file hostson localhost.

If you connect from a remote computer, you will receive the network address of the remote computers.

+4
source

Source: https://habr.com/ru/post/1741822/


All Articles