Click here to Skip to main content
11,495,869 members (59,753 online)
Click here to Skip to main content

Checking Internet Is Connected Or Not From .NET

, 16 May 2011 CPOL 8.3K 12
Rate this:
Please Sign up or sign in to vote.
For C# guys....using System ;using System.Runtime ;using System.Runtime.InteropServices ;public class Internet{ [DllImport("wininet.dll")] private extern static bool InternetGetConnectedState( out int Description, int ReservedValue ) ; public static bool...
For C# guys....

using System ;
using System.Runtime ;
using System.Runtime.InteropServices ;
 
public class Internet
{
 
    [DllImport("wininet.dll")]
    private extern static bool InternetGetConnectedState( out int Description, int ReservedValue ) ;
 
    public static bool IsConnectedToInternet( )
    {
        int Desc ;
        return InternetGetConnectedState( out Desc, 0 ) ;
    }
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

J a a n s
Software Developer (Senior)
India India
No Biography provided

Comments and Discussions

 
GeneralReason for my vote of 3 see my previous comment Pin
charles henington29-Apr-11 14:49
membercharles henington29-Apr-11 14:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150520.1 | Last Updated 16 May 2011
Article Copyright 2010 by J a a n s
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid