trying to fetch IP address using this:-
protected void Page_Load(object sender, EventArgs e)
{
string ClientIP;
ClientIP = HttpContext.Current.Request.UserHostAddress;
Label1.Text = ClientIP;
}
This code gives output as 127.0.0.1
and the code below displays nothing!
string ClientIP;
ClientIP = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
Label1.Text = ClientIP;
Hpw do I fetch the IP address ? the REAL IP address of a user ??
[EDIT]
I don't want EXACT location btw...need to know the country and then redirect the user to a webpage accordingly