Verifying User's Internet Connection
I am looking for a way to verify whether the user's computer has a valid internet connection.
Is there a function in .Net that will allow the underlying Windows internet connectivity detection to be checked?
Or do I have to hack something together like running a ping internally?
Any ideas of suggestions are greatly appreciated. ;)
While there is a way of determining if the system has a network connection, there is not to my knowledge a way of determining if there is an actually Internet connection without actually testing for a connection.
That's because until you actually test for such a connection, you have no way of knowing whether or not the local network actually provides a gateway to the Internet.
In VS2005, you do have the System.Net.NetworkInterface.GetIsNetworkAvailable method to determine if there is any network connection.
And then there is the System.Net.NetworkInformation.Ping method to ping an address.