问题
What is the difference between Request.ServerVariables["REMOTE_ADDR"]
and Request.UserHostAddress
?
Are either of these variables considered unreliable with respect to IP Address spoofing?
回答1:
The .ServerVariables is provided for compatibility with the old ASP method for getting that information. Most of the information provided through that is now provided through separate properties.
回答2:
They are the same, ServerVariables["REMOTE_ADDR"]
was provided only for backwards compatibility with older Classic Asp codebases. You should prefer using Request.UserHostAddress
.
来源:https://stackoverflow.com/questions/6537482/what-is-the-difference-between-request-servervariablesremote-addr-and-reques