Asp - Wan Ip

Discussion in 'Web Design & Coding' started by Admiral Michael, Mar 14, 2005.

  1. Admiral Michael

    Admiral Michael Michaelsoft Systems CEO Folding Team

    Hey all,

    I basically got this system script done the way I want (http://www.michaelsoft.gotdns.com/stats.asp) cept for the Server IP. Since the computer is behind a router it shows my LAN IP, which is the result of using Request.ServerVariables("LOCAL_ADDR").

    Any Ideas how to grab the IP (in ASP, dont want to mix languages. It all I kno besides HTML and a little javascript) from a site like http://checkip.dyndns.org or if you have another idea how to get the IP.

    Mike
     
  2. lad_in_brum

    lad_in_brum OSNN Addict

    Messages:
    138
    Location:
    Birmingham, UK
    Try REMOTE_ADDR
     
  3. NetRyder

    NetRyder Tech Junkie Folding Team

    Messages:
    13,256
    Location:
    New York City
    That would most probably end up displaying the internal IP of the router
    (...based on my very limited knowledge of ASP :))
     
  4. Zedric

    Zedric NTFS Guru Folding Team

    Messages:
    4,006
    Location:
    Sweden
    Isn't that the client's IP?

    In PHP I'd use $_SERVER['SERVER_NAME'], which displayes the name or IP used to reach the server (changes between LAN and WAN users). But I'm not sure what the corresponding variable in ASP is...

    You could of course parse http://checkip.dyndns.org/ using ASP and get the IP that way, but it's very slow since you have to do this every time you get a page access.
     
  5. lad_in_brum

    lad_in_brum OSNN Addict

    Messages:
    138
    Location:
    Birmingham, UK
    Sorry yes...its prob SERVER_NAME (The server's host name or IP address) then
     
  6. Admiral Michael

    Admiral Michael Michaelsoft Systems CEO Folding Team

    Thanks all, It seems it's more difficult then I thought. I think I will just have it show the LAN ip then.