为Request.ServerVariables [" REMOTE_ADDR&QUOT]足够可靠吗? [英] Is Request.ServerVariables["REMOTE_ADDR"] reliable enough?
问题描述
目前我使用Request.ServerVariables [REMOTE_ADDR]从客户端得到IP地址。
Currently I am using Request.ServerVariables["REMOTE_ADDR"] to get the IP from the client.
什么保证我得到调用此方法时。或者我应该看看在其他ServerVariables呢?
What guarantees I get when calling this Method. Or should I look in other ServerVariables as well?
推荐答案
从本质上讲,你应该也注意 Request.ServerVariables(HTTP_X_FORWARDED_FOR)
为好。这有助于确定实际的IP地址,如果最终用户是通过代理,而 REMOTE_ADDR
属性,除非它是一个匿名代理是代理服务器的地址...在这种情况下,你仍然只是得到了代理地址。
Essentially, you should probably also pay attention to the Request.ServerVariables("HTTP_X_FORWARDED_FOR")
as well. This helps to identify the actual IP address if the end user is going through a proxy whereas the REMOTE_ADDR
attribute would be the address of the proxy...unless it is an anonymous proxy in which case, you would still just get the proxy address.
这篇关于为Request.ServerVariables [" REMOTE_ADDR&QUOT]足够可靠吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!