This is the label
<asp:Label ID="lblIp" runat="server"></asp:Label>
Here Code I used to get user IP address
string VisitorsIPAddr = string.Empty;
if (HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null)
{
VisitorsIPAddr = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
lblIp.Text = VisitorsIPAddr;
}
else if (HttpContext.Current.Request.UserHostAddress.Length != 0)
{
VisitorsIPAddr = HttpContext.Current.Request.UserHostAddress;
lblIp.Text = VisitorsIPAddr;
}
but Always I got the same result. That was 127.0.0.1 and always it goes to else if state.
further
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] did not give any result. It always give nothing