public string GetClientIp()
{
var ipAddress = string.Empty;
if (_accessor.HttpContext.Request.Headers.ContainsKey("X-Forwarded-For") == true)
ipAddress = _accessor.HttpContext.Request.Headers["X-Forwarded-For"].ToString();
else if (_accessor.HttpContext.Request.Headers.ContainsKey("HTTP_CLIENT_IP") == true && _accessor.HttpContext.Request.Headers["HTTP_CLIENT_IP"].Count != 0)
ipAddress = _accessor.HttpContext.Request.Headers["HTTP_CLIENT_IP"];
else if (_accessor?.HttpContext?.Connection?.RemoteIpAddress?.ToString().Length != 0)
ipAddress = _accessor?.HttpContext?.Connection?.RemoteIpAddress?.ToString();
return ipAddress;
}