Acquiring client originating IP address (with Akamai and CloudFlare support) in ASP.NET Core

added by DotNetKicks
12/21/2018 1:44:19 PM

1 Kicks, 174 Views

Sometimes there is a need for a web application to acquire client originating IP address (location dependent content, audit requirements etc.). ASP.NET Core provides HttpContext.Connection.RemoteIpAddress property which provides originating IP address for the connection. In todays web the origin of connection seen by the web server is rarely the client, more likely the last proxy on the path.