I have a web page (.aspx) that calls a third party web service to get some data. It usually takes couple of seconds to get the response back, and then the rest of the page will load. Occasionally the call gets stuck either due to the web service is down, or internet connection, etc., the page just hang there and will not load.
My questions is:
1) Is there a way to abort/cancel the web service call after a set amount of time?
2) Is it even possible to verify the status of the web service before calling it?
Thanks.
This question will point you in the right direction. It talks about how to set a default timeout for the web service, so it will automatically cancel if it takes too long.
timeout for asynchronous web service call in C#
The only way to verify the status of a service is by calling it. You can tell if it down by the response you get. (500 404 etc.).
Here is the difference between the two and what Microsoft recommends.
http://msdn.microsoft.com/en-us/library/ms998562.aspx#scalenetchapt10_topic14