I am using .NET, C# and WPF, and I need to check whether the connection is opened to a certain URL, and I can\'t get any code to work that I have found on the Internet.
Use this:
private bool CheckConnection() { WebClient client = new WebClient(); try { using (client.OpenRead("http://www.google.com")) { } return true; } catch (WebException) { return false; } }