I want to check if my project can connect to the remote server by Webclient in ASP.NET C# and do something.

here is my code

WebClient webClient = new WebClient();
webClient.Credentials = new System.Net.NetworkCredential(username, password);

if (webClient.OpenRead(url83).IsConnected) // Here, i want to check
    XmlTextReader reader1 = new XmlTextReader(webClient.OpenRead(url83));
    reader1.WhitespaceHandling = WhitespaceHandling.None;
    //Do something

Related posts

Recent Viewed