I have not tested this but it looks legit:
[DllImport("wininet.dll")]private
extern static bool InternetGetConnectedState (out int
connectionDescription, int reservedValue ) ;
public bool IsConnected() {
int connectionDescription = 0;
return InternetGetConnectedState(out connectionDescription, 0);
}