string clientIp = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (!string.IsNullOrEmpty(clientIp)) { string[] forwardedIps = clientIp.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); clientIp = forwardedIps[forwardedIps.Length - 1]; } else { clientIp = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; } Response.Write(clientIp);
string IP= Server.HtmlEncode(Request.UserHostAddress);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)