I'm trying to detect what kind of network connection I'm connected to. is it WiFi or 3G? is there a way to do that using c# win forms .net 2.0 or 4.0 ?
foreach (NetworkInterface adapter in adapters)
{
if (adapter.OperationalStatus == OperationalStatus.Up)
{
if (adapter.NetworkInterfaceType == NetworkInterfaceType.Wireless80211)
{
lblNetworkType.Text = "you are using WiFi";
break;
}
else if (adapter.NetworkInterfaceType == NetworkInterfaceType.Ppp)
{
lblNetworkType.Text = "you are using 3G or ADSL or Dialup";
break;
}
else if (adapter.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
{
lblNetworkType.Text = "you are using Ethernet";
break;
}
}
}
NetworkInterface.GetAllNetworkInterfaces()
– Nonviolence