Win32 API InternetGetConnectedState
[DllImport("wininet.dll")]
private
extern
static
bool
InternetGetConnectedState(out
int connectionDescription,
int
reservedValue);
public
static
bool
IsConnected()
{
int
connectionDescription = 0;
return
InternetGetConnectedState(out
connectionDescription, 0);
}
Wininet.dll comes standard with Internet Explorer 4.0 and
higher.
Also, don't forget to import
System.Runtime.InteropServices, of course. ;-)