string strIPAddress = "";
if (Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != "" && Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null)
strIPAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
else if (Request.ServerVariables["REMOTE_ADDR"] != "" && Request.ServerVariables["REMOTE_ADDR"] != null)
strIPAddress = Request.ServerVariables["REMOTE_ADDR"];
Response.Write("Your IP " + strIPAddress);