R
R
rundll322022-03-01 19:23:24
ASP.NET
rundll32, 2022-03-01 19:23:24

Determine IP in ASP Core MVC?

Googled how to determine ip in ASP, found two solutions that did not help me, namely through adding a service

builder.Services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();

And through
context.Connection.RemoteIpAddress
In my case, both ip (on the screen) are still empty.
621e48789f5a0748029389.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2022-03-01
@vabka

On the screenshot you are looking at LocalIpAddress. What about Remote? And from what machine are you making the request? If you make a request from localhost to localhost, then Remote will be localhost :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question