public async Task OnPageHandlerExecutionAsync(PageHandlerExecutingContext context, PageHandlerExecutionDelegate next) { var ipAddress = context.HttpContext.Connection.RemoteIpAddress.MapToIPv4(); var geo = await _geoService.GetCountry(ipAddress.ToString()); if (geo != null && geo.ip != null) { _diagnosticContext.Set("Geo", geo, destructureObjects: true); } await next.Invoke(); }
public async Task <Country> Country(string code) { _LogService = new LogService(); _LogService.LogInfo($"------------ COUNTRY: countries/{code} ----------"); return(await _GeoService.GetCountry(code)); }