Click here to Skip to main content
13,508,228 members
Click here to Skip to main content
Add your own
alternative version

Stats

14.1K views
12 bookmarked
Posted 4 Jan 2010

Checking Internet Is Connected Or Not From .NET

, 16 May 2011
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

You may also be interested in...

Comments and Discussions

 
Generalit doesn't work Pin
The_Brain26-Apr-11 1:02
memberThe_Brain26-Apr-11 1:02 
GeneralReason for my vote of 4 Easy way Pin
Dorababu74322-Apr-11 3:25
memberDorababu74322-Apr-11 3:25 
GeneralReason for my vote of 2 u can directly ping any site without... Pin
--K O-- Solutions18-Apr-11 23:41
member--K O-- Solutions18-Apr-11 23:41 
GeneralReason for my vote of 5 simpler Pin
fdunn318-Apr-11 16:14
memberfdunn318-Apr-11 16:14 

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

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

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