Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 11
    Overly complicated. MVC already calls that internally and puts it under HttpContext.Connection.RemoteIpAddress. Commented Apr 22, 2016 at 12:28
  • @Fred - your version returns null for me in RC-1 - IIS and Kestrel Commented May 3, 2016 at 0:15
  • I get ::1 value, not the IP format. Commented Jun 1, 2022 at 9:33