I used the code below to get the client ip with asp.net earlier, but after I switched to VDS, this function will only start returning my subnet mask, which is 178.18.198.1 or 178.18.198.2. Can someone help me with this problem?
Private Function GetIPAddress() As String Dim sIPAddress As String = Nothing sIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR") If String.IsNullOrEmpty(sIPAddress) Then sIPAddress = Request.ServerVariables("REMOTE_ADDR") End If Return sIPAddress End Function
EDIT
Found a similar problem here :
Many 32-bit versions of 2008 were deployed by standard web servers using citrix netscaler isapi (netscaler is a load balancer), in all cases the client's IP address is logged in standard IIS logs. In a new project, I was asked to deploy 2008 R2, configured IIS 7.5 in the same way as I configured IIS 7.0 in the past, this time, however, the client ip returns the load balancing address to the logs. Here is the weird part, I installed the "extended log", and this is mapping the client IP address correctly, so isapi does the job. Googled this one to death and could use some tips.
I also found the ISAPI filter module, but can't get it working: devcentral.f5.com/x_forwarded_for_log_filter_for_windows_servers
source share