How to check for availability of Internet in Windows 8

///

/// Property that returns the connection profile [ ie, availability of Internet ]

/// Interface type can be [ 1,6,9,23,24,37,71,131,144 ]

/// 1 – > Some other type of network interface.

/// 6 – > An Ethernet network interface.

/// 9 – > A token ring network interface.

/// 23 -> A PPP network interface.

/// 24 -> A software loopback network interface.

/// 37 -> An ATM network interface.

/// 71 -> An IEEE 802.11 wireless network interface.

/// 131 -> A tunnel type encapsulation network interface.

/// 144 -> An IEEE 1394 (Firewire) high performance serial bus network interface.

///

public static bool IsConnectedToNetwork

{

get

{

var profile = NetworkInformation.GetInternetConnectionProfile();

if (profile != null)

{

var interfaceType = profile.NetworkAdapter.IanaInterfaceType;

return interfaceType == 71 || interfaceType == 6;

}

return false;
}

}

Advertisements

One thought on “How to check for availability of Internet in Windows 8

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s