我试过用下面提到的方法获取ip
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] &
Request.UserHostAddress & Request.ServerVariables["REMOTE_ADDR"]
问题是 Request.ServerVariables["REMOTE_ADDR"]
返回代理 ip 和
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]
可以被篡改
最佳答案
i want a foolproof method of fetching ip of client which cannot be tampered
不存在。对不起。
The problem is this that Request.ServerVariables["REMOTE_ADDR"] return Proxy ip
假设用户在公司代理后面。您将获得此代理 IP,就所有意图和目的而言,它是最接近用户 IP 的东西。我的意思是,如果您获得用户的最终内部 IP,例如 192.168.0.15,那对您有什么用?
关于c# - ASP.NET 中用户 IP 地址的防弹检测,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3821652/