Getting Remote IP Address using HttpContext in .NET Core

I still have my site on my machine and I am debugging. Using this solution:

so I have

clientRemoteIP = context.Request.HttpContext.Connection.RemoteIpAddress.ToString(); 

Like one of the commenters I am also seeing “::1” when I try that. They said that was IPv6 format but I am wondering if it is just giving that because I am debugging and it won’t on a server, or is there something else I can try? I can’t easily push this to DEV until we are much farther along.

I am using the latest version of core (just set up the project 2 weeks ago)

submitted by /u/shellwe
[link] [comments]

Leave a Reply