Vibin Jith
Vibin Jith

Reputation: 931

I am getting the wrong client IP address

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.

Upvotes: 2

Views: 702

Answers (1)

Oded
Oded

Reputation: 499002

You are getting the right one. 127.0.0.1 is the loopback IP address, which is mapped in your hosts file to localhost.

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

Upvotes: 4

Related Questions