{"id":20816708,"url":"https://github.com/moritzrinow/aspnetgeo","last_synced_at":"2026-04-19T23:33:19.754Z","repository":{"id":144546650,"uuid":"247919626","full_name":"moritzrinow/aspnetgeo","owner":"moritzrinow","description":"Add geo information to the ASP.NET Core request pipeline","archived":false,"fork":false,"pushed_at":"2020-06-18T12:15:16.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-12T05:41:25.329Z","etag":null,"topics":["asp-net-core","geoip","geolocation","maxmind"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moritzrinow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-17T08:43:14.000Z","updated_at":"2020-06-28T09:36:30.000Z","dependencies_parsed_at":"2023-06-29T05:15:18.495Z","dependency_job_id":null,"html_url":"https://github.com/moritzrinow/aspnetgeo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/moritzrinow/aspnetgeo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moritzrinow%2Faspnetgeo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moritzrinow%2Faspnetgeo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moritzrinow%2Faspnetgeo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moritzrinow%2Faspnetgeo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moritzrinow","download_url":"https://codeload.github.com/moritzrinow/aspnetgeo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moritzrinow%2Faspnetgeo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32026619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net-core","geoip","geolocation","maxmind"],"created_at":"2024-11-17T21:36:23.612Z","updated_at":"2026-04-19T23:33:19.708Z","avatar_url":"https://github.com/moritzrinow.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aspnetgeo\nAdd geo information to the ASP.NET Core request pipeline\n\n## Supported providers\n\n- MaxMind\n\n## Usage\n \n#### Install package\n \ndotnet add package AspNetGeo\n\n#### Download free MaxMind databases and group them in a folder\n\nhttps://dev.maxmind.com/geoip/geoip2/geolite2/\n \n#### Add GeoIpMiddleware to the pipeline\n```csharp\npublic void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n{\n  // ...\n  \n  app.UseGeoIp();\n  \n  // ...\n}\n```\n\n#### Use MaxMind as GeoIpProvider\n```csharp\npublic void ConfigureServices(IServiceCollection services)\n{\n  // ...\n  \n  // Use path to directory with MaxMind database files\n  services.UseMaxMindGeoIp(Path.Combine(Directory.GetCurrentDirectory(), \"data\"));\n  \n  // ...\n}\n```\n\n#### Include in-memory cache\n```csharp\npublic void ConfigureServices(IServiceCollection services)\n{\n  // ...\n  \n  // Use path to directory with MaxMind database files\n  services.UseMaxMindGeoIp(Path.Combine(Directory.GetCurrentDirectory(), \"data\"));\n  services.AddGeoIpInMemoryCache();\n  // ...\n}\n```\n\n#### Access GeoIp data via HttpContext extension method (data sits in HttpContext.Items under key 'geoIp')\n\n```csharp\nIGeoIp geoIP = context.GetGeoIp();\n```\n\n#### The GeoIp data structure\n\nThe name dictionaries are designed to be: locale (\"en\", \"de\" etc.) -\u003e name. \nThe continent \u0026 country codes should come as ISO alpha-2.\n\n```csharp\npublic interface IGeoIp\n{\n  IReadOnlyDictionary\u003cstring, string\u003e CityNames { get; }\n\n  string ContinentCode { get; }\n\n  IReadOnlyDictionary\u003cstring, string\u003e ContinentNames { get; }\n\n  string CountryCode { get; }\n\n  IReadOnlyDictionary\u003cstring, string\u003e CountryNames { get; }\n\n  GeoLocation Location { get; }\n\n  string PostalCode { get; }\n\n  string RegionCode { get; }\n\n  IReadOnlyDictionary\u003cstring, string\u003e RegionNames { get; }\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoritzrinow%2Faspnetgeo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoritzrinow%2Faspnetgeo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoritzrinow%2Faspnetgeo/lists"}