در صورتیکه مقدار بازگردانده شده از این تابع IsConnectedToInternet برابر true باشد ، سیستم به اینترنت متصل است

using System.Runtime.InteropServices;

[DllImport("wininet.dll")]        
 private extern static bool InternetGetConnectedState(out int Description, int ReservedValue);
 //Creating a function that uses the API function...
bool IsConnectedToInternet()
 {
     bool a;
     int Desc;
     a=InternetGetConnectedState(out Desc, 0);
     return a;
 }