1

Any clu how we can use get_IsConnectedToInternet property under C#?

http://msdn.microsoft.com/en-us/library/aa965311(v=vs.85).aspx

Thank you!

NoWar
  • 36,338
  • 80
  • 323
  • 498
  • 2
    have a look here: http://stackoverflow.com/questions/8027791/specific-network-interface-ipv4-availability-no-connectivity-local-internet – Felice Pollano Jul 09 '12 at 12:34

1 Answers1

1

This is a simplified version of the call.
It tells if you have an internet connection available, not if you are connected.

    [DllImport("wininet.dll")]
    private extern static bool InternetGetConnectedState( out int Description, int ReservedValue ) ;

    public static bool IsConnectedToInternet( )
    {
        try
        {
            int Desc;
            return InternetGetConnectedState(out Desc, 0);
        }
        catch 
        {
            return false;
        }
    }
Steve
  • 213,761
  • 22
  • 232
  • 286
  • @PArt If you post an alternative solution I would be glad to upvote yours. Or at least provide the information on which you have based your comment. – Steve Sep 24 '18 at 09:55