Answer the question
In order to leave comments, you need to log in
How to get user's IP address via httpContextAccessor in asp.NET Core?
Good evening!
I had a task to log an error and the IP address of the user in which it occurred.
The bottom line is that I can’t figure out how to get an IP address through httpContextAccessor (The task is to get an IP through it).
There was one option that ended up giving me ::1 (httpContextAccessor.HttpContext.Connection.RemoteIpAddress) , is that correct? I doubt it, because through the Dns class I received more detailed information about IP addresses (Dns.GetHostEntry(Dns.GetHostName()).AddressList())
Answer the question
In order to leave comments, you need to log in
There was one option that ended up giving me ::1 (httpContextAccessor.HttpContext.Connection.RemoteIpAddress) , is that correct?
I doubt it, because through the Dns class I received more detailed information about IP addresses (Dns.GetHostEntry(Dns.GetHostName()).AddressList())
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question