c# tagged posts

Programmatically check if internet connection is available on Windows 8

Category: Windows 8 Comments: No comments

I’m finally on holidays and I can spend some hour developing for Windows 8.
My application is now checked by Microsoft and I hope I will have a green flag! :)

In my application I need to check if the internet connection is available. According to Microsoft documentation you just need to check your ConnectionProfile: if it is null you are not connected to internet, otherwise you do. But I don’t think it is enough.

In fact if you have a Virtual Machine installed on your laptop, or some virtual Network card your profile won’t never be null. I tried (for example) disabling all my real network device (wireless and wired) but my profile was still active.

Below the solution I found: if your profile is not null, you have to check the NetworkConnectivityLevel: if the value is NetworkConnectivityLeve...

Read More