ASP.NET Core

How to get IP address in dotnet core

Follow the below steps for get IP address in dotnet core.

  1. Add Namespace in you controller
  2. Create private variable for IHttpContextAccessor
  3. Add Dependency Injection in controller
  4. Change in your Startup.cs
  5. Get The IP Address
     

Finally your controller should be look like below

 

 

Tags
Show More

Leave a Reply

Your email address will not be published. Required fields are marked *

Close