Using help of NetworkInterface class of System.Net.NetworkInformation
the internet connection can be detected. see the code below for more details
Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyCRND
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine((System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() == true ? "Connected" : "Not Connected"));
Console.ReadLine();
}
}
}
Join the conversation! Your thoughts help the community grow.