When integration to external services in Dynamics NAV, it is sometime nice to know if you are on the Internet.
This can easily be tested using .NET.
Create 2 variables and at Global TryFunction in a Codeunit.
WebClient := WebClient.WebClient(); Stream := WebClient.OpenRead('https://www.google.com');
Now you call this function from you code and use the boolean result.
Pre NAV 2016 you have to use a Codeunit alone and put the code in OnRun() and use the return from calling the Codeunit.