How to determine which network adapter is connected to the internet

I ended up following a link to MSDN when I was reading this page where I found the GetBestInterface function. I was able to use that to find the adapter thats connected to the internet


You can use WMI to query all the adapters and see which one is connected.
This article shows you how to do it in VB.Net (very easily transferable to C#).


See here for a similar question on how to monitor the bandwidth used, in VB.NET, but the philosophy is the same! Here is another question that is the fastest way of checking for internet connection.

Hope this helps, Best regards, Tom.