0

WebClient and HttpWebRequest throw WebException when connecting to an unavailable address. I've seen some techniques that use BeginGetResponse that avoid throwing exceptions in this case. But they rely heavily on the Async keyword. Is there any way to check a HTTP service without throwing exceptions and using only .NET 3.5?

Jader Dias
  • 162
  • 1
  • 9
  • what's the problem with exceptions? are you handling them? try catch... – jandresrodriguez Nov 21 '13 at 14:32
  • what you want to do when error occur if you don't want to handle exception? – Bhavesh Kachhadiya Nov 21 '13 at 14:33
  • If you develop a program mostly exception-free it's easier to debug. I maintain a big application and this is the only exception thrown when everything is in normal conditions. I would like to HttpWebRequest to return the status code so I could decide for myself what to do with it. – Jader Dias Nov 21 '13 at 15:51

0 Answers0