[DllImport("wininet.dll")] private extern static bool InternetGetConnectedState( out int Description, int ReservedValue ); public static bool IsConnectedToInternet( ) { int Desc ; return InternetGetConnectedState( out Desc, 0 ) ; }
System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("http://www.google.com"); req.Method = "HEAD"; System.Net.HttpWebResponse resp = (System.Net.HttpWebResponse)req.GetResponse(); resp.Close(); return true;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)