How to get a user's client IP address in ASP.NET?

前端 未结 19 2586
时光取名叫无心
时光取名叫无心 2020-11-22 00:26

We have Request.UserHostAddress to get the IP address in ASP.NET, but this is usually the user\'s ISP\'s IP address, not exactly the user\'s machine IP address

19条回答
  •  一整个雨季
    2020-11-22 00:45

    What else do you consider the user IP address? If you want the IP address of the network adapter, I'm afraid there's no possible way to do it in a Web app. If your user is behind NAT or other stuff, you can't get the IP either.

    Update: While there are Web sites that use IP to limit the user (like rapidshare), they don't work correctly in NAT environments.

提交回复
热议问题