public string ResolveIp(HttpContext httpContext)
        {
            IPAddress clientIp = null;

            if (httpContext.Request.Headers.TryGetValue(_headerName, out var values))
            {
                clientIp = IpAddressUtil.ParseIp(values.Last());
            }

            return(clientIp?.ToString());
        }
Пример #2
0
 public static IPAddress ParseIp(string ipAddress)
 {
     return(IpAddressUtil.ParseIp(ipAddress));
 }