To check internet connection is available or not using C# Code use below code
WebClient client = new WebClient(); byte[] datasize = null; try { datasize = client.DownloadData("http://www.google.com"); } catch (Exception ex) { } if (datasize != null && datasize.Length > 0) { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Internet Connection Not Available.');", true); } else { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('.Internet Connection Not Available.');", true); }