.net 4.0

Catching timeout in C# for web service call  #angularjs #reactjs

  • Preference is to catch the timeout exception specifically and alert the user of the timeout.
  • When a timeout occurs, if I print out the exception type, I get System.
  • I’m using C# .Net to call a web service asynchronously and would like to add a timeout.
  • Stack Overflow works best with JavaScript enabled
  • I’d rather not use the generic Exception since it’s very broad.

I’m using C# .Net to call a web service asynchronously and would like to add a timeout. I cannot figure out how to catch the timeout exception correctly.

@ng_real_ninja: Catching timeout in C# for web service call #angularjs #reactjs

I’m using C# .Net to call a web service asynchronously and would like to add a timeout. I cannot figure out how to catch the timeout exception correctly.

I’d rather not use the generic Exception since it’s very broad. Preference is to catch the timeout exception specifically and alert the user of the timeout.

When a timeout occurs, if I print out the exception type, I get System.Net.WebException.

Is there a better way to catch the timeout exception?

.net 4.0