Esempio n. 1
0
        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());
        }
Esempio n. 2
0
 public static IPAddress ParseIp(string ipAddress)
 {
     return(IpAddressUtil.ParseIp(ipAddress));
 }