codingfactor.com
How to get IP address in dotnet core - Coding Factor
Follow the below steps for get IP address in dotnet core. Add Namespace in you controller [crayon-5ce9999376f72999997928/] Create private variable for IHttpContextAccessor [crayon-5ce9999376f7d451982494/] Add Dependency Injection in controller [crayon-5ce9999376f82493150640/] Change in your Startup.cs [crayon-5ce9999376f85759260962/] Get The IP Address [crayon-5ce9999376f87662299490/] Finally your controller should be look like below [crayon-5ce9999376f8a600247127/]