Tuesday, July 14, 2009

Detecting Client IP address

To keep track of Visitor's Record such as IP address and all
then u can use this way ,
it will display the Client proxy ip address , if the client is using Proxy server.



if (Context.Request.ServerVariables["HTTP_VIA"] != null)
{
IP = Context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}
else
{
IP = Context.Request.ServerVariables["REMOTE_ADDR"].ToString();
}

No comments:

Post a Comment