We use IHttpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString()
to get IP of the device sending request. But when the device is connected to WIFI
, we get the WIFI IP
. Instead, i would like to get the device IP. How to do it in .net core 3.1
?
Asked
Active
Viewed 216 times
-1

Raj
- 319
- 1
- 3
- 18
-
What do you mean by "Device IP" and "WIFI IP"? Can you give us an example of what the correct and the wrong values are? If you can get the "WIFI IP", why is that not good enough? – omajid Jul 06 '20 at 03:41
1 Answers
0
There is no such thing as WIFI IP, nor is DEVICE IP an actual concept. A device will typically have an internal ip and and external ip. When on the same local network, such as in your case, you will most likely get the internal ip. If you need the external ip, there are many (http) services that you can call to get your own external ip.
Edit: See this previously asked question: Get local IP address

Malte R
- 468
- 5
- 16
-
my actual question boils down to - how to get that internal IP in .net core 3.1? – Raj Jul 09 '20 at 18:07