0

Hope you all are fine. I'm working on a project that based on vue-js (FRONTEND) and .net core web api (BACKEND).

The issue I'm facing is I've to get the client IP-ADDRESS using that C# dll which is located in Server. I don't know how to get it.

Please let me know if any of you know.

Will be highly appreciated.

1 Answer 1

2

The requester's IP address can be found on the Connection value of the HttpContext for the request, as RemoteIpAddress. For example, in an ASP.NET Core controller action:

public IActionResult MyAction()
{
    IPAddress? ipAddress = Request.HttpContext.Connection.RemoteIpAddress;

    return Ok();
}

As noted in docs, this might be null.

Sign up to request clarification or add additional context in comments.

3 Comments

Will it be client side IP-ADDRESS ?
It will be the IP address of the requester seen by the server. This would be the client's IP in the case it isn't masked by a proxy or something else.
OK let me implement it, Then I'll let you know.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.