Get External IP

Discussion in 'ASP .Net' started by Marc Rivait, Apr 23, 2004.

  1. Marc Rivait

    Marc Rivait Guest

    I have been struggling this one. As part of a application we want to
    control IP addresses which come to our site.

    On the web page we get the IP of the client computer using
    Request.UserHostAddress(). However, if a user is coming to us from behind a
    NAT, all we get is the internally assigned IP. We need to see the external
    IP. I have not been able to find a method for getting this.

    Thanks,
    Marc.
     
    Marc Rivait, Apr 23, 2004
    #1
    1. Advertising

  2. Marc Rivait

    Curt_C [MVP] Guest

    You won't, not with a server technology at least. If they are coming through
    some sort of VPN/etc and getting a NAT then that's what you'll get really.
    Same thing if people are behind a proxy, you may get ONE IP for an entire
    company.

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    Site: http://www.Darkfalz.com
    Blog: http://blog.Darkfalz.com


    "Marc Rivait" <> wrote in message
    news:%...
    > I have been struggling this one. As part of a application we want to
    > control IP addresses which come to our site.
    >
    > On the web page we get the IP of the client computer using
    > Request.UserHostAddress(). However, if a user is coming to us from behind

    a
    > NAT, all we get is the internally assigned IP. We need to see the

    external
    > IP. I have not been able to find a method for getting this.
    >
    > Thanks,
    > Marc.
    >
    >
     
    Curt_C [MVP], Apr 23, 2004
    #2
    1. Advertising

  3. Marc Rivait

    Raterus Guest

    Actually I think you have it backwards, NAT takes the internal ip and rewrites the packet with the external ip, if your visitors are hitting your site with an internal IP, they never had an external ip to begin with, and there would be no way of getting it unless you reroute traffic.

    It's probably much easier and more secure to control IP access at IIS rather than in your asp.net application., you should be able to make it so only certain IP's can access your site.

    "Marc Rivait" <> wrote in message news:%...
    > I have been struggling this one. As part of a application we want to
    > control IP addresses which come to our site.
    >
    > On the web page we get the IP of the client computer using
    > Request.UserHostAddress(). However, if a user is coming to us from behind a
    > NAT, all we get is the internally assigned IP. We need to see the external
    > IP. I have not been able to find a method for getting this.
    >
    > Thanks,
    > Marc.
    >
    >
     
    Raterus, Apr 23, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    809
  2. Scott Allen
    Replies:
    8
    Views:
    11,043
    Scott Allen
    May 2, 2004
  3. Michele Petrazzo

    Execute external code and get return value

    Michele Petrazzo, Sep 29, 2006, in forum: Python
    Replies:
    4
    Views:
    323
    Peter Otten
    Sep 29, 2006
  4. Huayang Xia
    Replies:
    11
    Views:
    473
    Fredrik Lundh
    Dec 19, 2006
  5. Mellow Crow
    Replies:
    6
    Views:
    438
    Richard Cornford
    Nov 4, 2005
Loading...

Share This Page