See CodeProject article: "How to use the Windows NLM API to get notified of new network connectivity" [
^].
But, keep in mind that as the .NET FrameWork has evolved, so has its facilities for access to the state of network/internet-connections changed: [
^].
You should evaluate any possible changes, or other methods, in Win >= 8 [
^].
Also, consider Eric Lippert's comment: "Also, note that there is no way to check if the user is connected to the internet; all you can tell is if they were connected in the past. Suppose you had a method: "bool c = IsConnected(); if (c) { DoSomething(); } " -- between the call to IsConnected and DoSomething, the wireless network router might have been unplugged. IsConnected really should be called WasRecentlyConnected. – Eric Lippert Jan 9 '10 at 15:47" ... on a StackOverFlow thread: [
^].