External (ISP) IP Address in WinPhone 8.1 RRS feed

  • Question

  • Hello guys!

    I have been now seeking a solution for one week!

    I could find different coding patterns like System.Net.Dns .. etc, but it seems it is not working anymore in Windows Phone 8.1 as System.Net does not contain now any Dns!! Different web forums use .Net Framework as well in such coding, which is not working as well!

    Any workaround??

    Thank you very much!

    Wednesday, October 22, 2014 1:36 PM


All replies

  • Hi Tweetatoo,

    Yes, use NetworkInformation class to find the external ip address. Code looks like the following.

    private void btn_Click(object sender, RoutedEventArgs e)
                msg.Text = Find().FirstOrDefault();
            public static List<string> Find()
                List<string> ipAddresses = new List<string>();
                var hostnames = NetworkInformation.GetHostNames();
                foreach (var hn in hostnames)
                    if (hn.IPInformation != null)
                        string ipAddress = hn.DisplayName;
                return ipAddresses;

    If you still have questions, please post more information about your scenario.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Thursday, October 23, 2014 1:44 AM
  • Unfortunately this code calls the local LAN IP, but not the IP from the ISP!
    • Edited by Tweetatoo Sunday, October 26, 2014 4:09 AM
    Sunday, October 26, 2014 4:09 AM
  • How is the phone connected to the internet?  If it is connected to the internet via a wireless router I would expect the IP to be a local network IP.  

    Sunday, October 26, 2014 1:17 PM
  • Exactly! It is connected through a router and this code gets the IP of the local connection (obtained from the DHCP). But what I am seeking is the external IP of the router (the IP of the ISP).

    Any workaround?

    Sunday, October 26, 2014 3:59 PM
  • I think you would have to call a web service which returns your external ip.

    I think reading the response from this url will give you the ip you are looking for


    Sunday, October 26, 2014 4:30 PM