public string ResolveIp() { IPAddress clientIp = null; var httpContent = _httpContextAccessor.HttpContext; if (httpContent.Request.Headers.TryGetValue(_headerName, out var values)) { clientIp = IpAddressUtil.ParseIp(values.Last()); } return(clientIp?.ToString()); }
public static IPAddress ParseIp(string ipAddress) { return(IpAddressUtil.ParseIp(ipAddress)); }