Connection Status

Sep 9, 2013 at 1:16 AM
What is the best way to get connect or disconnected status ?
Coordinator
Sep 14, 2013 at 3:18 PM
If you're talking about a RAS connection, you can simply call the RasConnection.GetActiveConnections() method and see if the connection you're interested in is present in the result. If you're talking about whether the machine is connected to the Internet, it can't.
RasConnection conn = RasConnection.GetActiveConnections().Where(o => o.EntryName = "Your Entry").SingleOrDefault();
if (conn != null)
{
    // The connection is currently active.
}
I hope that answers your question!