Get IP Address of Visitor's Machine

Dim ipaddress As String
ipaddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If ipaddress = "" Or ipaddress Is Nothing Then
ipaddress = Request.ServerVariables("REMOTE_ADDR")
End If
When users use any proxies or routers the REMOTE_ADDR returns the IP Address of router or proxy and not the client user’s machine. So first we need to check HTTP_X_FORWARDED_FOR.

No comments:

Post a Comment