Forum Discussion
Aniket_129589
Jul 27, 2013Nimbostratus
Thanks Kevin for your continuous help on this.
This is just to inform you that we are using the below piece of codes to track the customer IP addresses.
string _custIP = null;
_custIP = HttpContext.Current.Request.ServerVariables["HTTP_CLIENT_IP"];
if (String.IsNullOrEmpty(_custIP))
{
_custIP = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
}
if (String.IsNullOrEmpty(_custIP))
{
_custIP = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
}
Customer IP1 = _hrHttpRequest.ServerVariables["REMOTE_ADDR"];
Customer IP2 = _custIP ;
Customer IP3 = _hrHttpRequest.UserHostAddress.ToString() ;
Customer IP4 = _hrHttpRequest.ServerVariables["HTTP_X_FORWARDED_FOR"];
We are receiving public IPs from the first three variables (and all of the three variables are capturing same IP address) and receiving NULL value in the last variable.
We are having one business intelligence tool which captures the customer IP addresses from the network itself and the IP address mismatch is seen from there. Just for an example, our piece of code has captured a customer IP address as 86.1.65.146, however the tool has captured the same as 2.103.197.20, which seems to be correct.
Please could you advice.
Many Thanks and Regards,
Aniket Samanta