] answer should help you along your way in Win8.
The gist of the answer is this:
I found the information you need using NetworkInformation and HostName.
NetworkInformation.GetInternetConnectionProfile retrieves the connection profile associated with the internet connection currently used by the local machine.
NetworkInformation.GetHostNames retrieves a list of host names. It's not obvious but this includes IPv4 and IPv6 addresses as strings.
Using this information we can get the IP address of the network adapter connected to the internet like this:
public static string CurrentIPAddress()
var icp = NetworkInformation.GetInternetConnectionProfile();
if(icp != null && icp.NetworkAdapter != null)
var hostname =
hn.NetworkAdapter != null &&
if(hostname != null)
Note that HostName has properties CanonicalName, DisplayName and RawName, but they all seem to return the same string.
We can also get addresses for multiple adapters with code similar to this:
IEnumerable<connectionprofile> profiles =
p => p.NetworkAdapter != null).ToList();
IEnumerable<hostname> hostnames =
NetworkInformation.GetHostNames().Where(h=>h.NetworkAdapter != null).ToList();
foreach (ConnectionProfile profile in profiles)
If I connect a wireless network as well as my wired network then on my machine I get:
Wired Ethernet Connection, 192.168.1.71
My SSID, 192.168.1.72