Request.UserHostAddress issue with return result “::1”

前端 未结 4 1718
有刺的猬
有刺的猬 2020-12-03 06:18

I am trying to get client ip address using

    HttpContext.Request.UserHostAddress;

but it returns ::1.

How to solve

4条回答
  •  醉梦人生
    2020-12-03 07:11

    Although it's true that this is not a bug, maybe you can check this link, where your problem is nicely described and "solved". It says that the way the issue behaves depends on the operating system, since a user fixed some problems in an application running in Windows Server 2008 by commenting the ::1 line in the hosts file, while he had to uncomment it in Windows 7.

    Hope you managed to solve that! Good luck!

提交回复
热议问题