Operations | Monitoring | ITSM | DevOps | Cloud

March 2023

How to get the client IP in ASP.NET Core even behind a proxy

Part of implementing an error monitoring platform like elmah.io is dealing with the IP addresses of the clients generating errors. In this post, I'll show you parts of how we have implemented this in ASP.NET Core, to make sure that different hosting scenarios still produce the correct IP address. Let's jump right in. ASP.NET Core supports getting the client IP directly on the HttpContext object available throughout various places.