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,
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!