1
  public string GetIPAddress()
  {        
    try
    {
        return  Request.UserHostAddress;
    }
    catch (Exception ex)
    {
        return ex.ToString();
    }
 }

My .Net Application run on this public IP 200.191.124.500 and i am trying to access public IP using above function but it is given me public IP of my server.

How do I get public and private IP of computer where ASP.NET application open?

it should be match with https://www.whatismyip.com/

User
  • 1,334
  • 5
  • 29
  • 61
  • 1
    You question is unclear. Where is the code you posted running? Are you asking how to obtain the client/browser IP from your server? If so, and you're getting "the ip of your server" then it's likely your server is behind a load balancer. You should ask your provider how to _properly_ obtain the _original/originating client ip_ - usually sent in `http header`. – EdSF Aug 02 '18 at 04:58
  • @EdSF yes ,we required client public IP from myserver . I want know which network access my page – User Aug 02 '18 at 05:27
  • 1
    Possible duplicate of [this](https://stackoverflow.com/questions/735350/how-to-get-a-users-client-ip-address-in-asp-net) – Nagib Mahfuz Aug 02 '18 at 06:12

0 Answers0