在 Web API 项目中编写代码时如何在 ASP.NET 3.1 中获取客户端 IP 地址
最佳答案
使用本教程。希望它会帮助你。
Get client IP address in Asp.NET core 3
或者只是在您的 Controller 中使用这行代码:
var ip =HttpContext.Connection.RemoteIpAddress.ToString()
关于asp.net-core - 如何在 ASP.NET CORE 3.1 中获取客户端 IP 地址?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59711763/