REMOTE_ADDR1 ASP.net 클라이언트IP 얻기 public static string GetClientIP() { try { HttpContext hc = HttpContext.Current; if (hc == null) return string.Empty; string ipList = hc.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (!string.IsNullOrWhiteSpace(ipList)) { return ipList.Split(',')[0]; } return hc.Request.ServerVariables["REMOTE_ADDR"]; } catch(Exception ex) { Console.Write(ex.ToString()); } return string.Empty; } 2022. 1. 6. 이전 1 다음 반응형