How to check internet connection using c#? Here is a simple example to find out internet connection or page response using c -Sharp CODE: 1 : Using System.Net ; 2 : try{ 3 : HttpWebRequest request= (HttpWebRequest) HttpWebRequest.Create("google.com"); 4 : HttpWebResponse response= (HttpWebResponse) request.GetResponse(); 5 : if (HttpStatusCode.OK == response.StatusCode) 6 : { 7 : //Write here your code... 8 : response.Close(); 9 : } 10 : }catch (Exception ex){ 11 : MessageBox.Show("Unable to connect"); 12 : }
Code & help 4 PHP, JavaScript, HTML, DHTML, CSS, Flex, Dot Net, SharePoint, C-Sharp, Java, ReactJs, NextJs, Node, Web Tools, Blockchain