none
Can somebody explain to me how I can detect that an internet connection exists (VB)? RRS feed

  • Question

  • Can somebody explain to me how I can detect that an internet connection exists (VB)?

    Peter Goossens

    Sunday, February 15, 2015 6:05 PM

Answers

  • There is no reliable way. Better test whether you can go to where you want to go. And be prepared to support proxies, even the complex ones that require authentication. 

    System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable reports your local connectivity regardless of whether one of your connected networks has Internet access.

    Microsoft's Network Awareness API (the one used in control panel\network and sharing center) use a connection test to a web site setup by Microsoft. But your customers could be behind cooperative firewalls that make this test unusable even when Internet access is available though other means (e.g. via a local proxy server). If you want to connect to your own web site, then you can skip that and just connect to your web site instead. Even if you were able to connect to Microsoft's web site there is no guarantee your web site would be accessible in the same network.



    Visual C++ MVP



    Sunday, February 15, 2015 7:21 PM