What is the best way to determine whether there is an available Internet connection for a WinForms app. (Programatically of course) I want to disable/hide certain functions
A guess at Internet connectivity would be network availability, at NetworkInterface.GetIsNetworkAvailable()
. The events on NetworkChange
can tell you when it changes. Both classes are in the System.Net.NetworkInformation
namespace.
Of course, you won't know if the Internet is really available until you try to connect to something.