0

In a website I need to store visitor's IP address for security logging. I m not sure about IP address and its details just have an idea there are different types of IP addresses like user, internet provider, LAN IP, WAN IP etc.

I am even not sure which IP address I should store in database for security I have searched and came to know about Request.UserHostAddress that it returns The IP address of the remote client.

Can you please guide and confirm if I am sotring correct IP and using correct code to retrive IP ?

Edit I am not certain why IP address is stored but know just as a good practice to do it. My guess is IP need to be stored to identify user, just in case if something wrong happens, with stored IP address it can be traced out who did it or from what area this request came.

Is there some other use of IP, please direct me as well.

Cheers

4

1 回答 1

2

IP 代表 Internet 协议,它是 HTTP 的底层协议,客户端用来连接到 Web 服务器。IP 网络上的每台机器都有一个唯一的 IP 地址。

UserHostAddress是识别客户端 IP 地址的正确属性。客户端来自 LAN 还是 WAN 无关紧要,他们的互联网提供商是谁也无关紧要。互联网提供商(我在这里简化了)帮助将流量路由到您的网站,但实际上并不作为端点参与;ISP 的服务器不会显示在 中UserHostAddress,只有启动连接的实际客户端,通常是用户。

请注意,我通常说. IP 地址可以被欺骗,或者它们可以隐藏在代理(如 TunnelBear)或其他混淆系统(如 Tor)之后。无法保证您拥有“真实”用户的“真实”IP 地址,但上述属性是您能够获得的最接近的属性。

于 2013-09-22T23:36:55.123 回答