If you are using a webrequest, you can set the timeout of the webrequest. An
exception will be thrown if the timeout has been exceeded.
--
Regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @
www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------
"Rudiga" <no**@none.net> wrote in message
news:ES*******************@newsfe2-gui.ntli.net...
Its a webservice
"Arran Pearce" <ar*********@cellhire.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... You need to change the timeout for the service. This depends on what
sort of service you are accessing. Is it a WebService? TCP/IP?
"Rudiga" <no**@none.net> wrote in message
news:Qw*******************@newsfe5-gui.ntli.net... Hi
I am trying to build in a try-catch block to access a web service and
am trying to control how long it attempts to access to service before
running the catch part of the code. Is there a specific way of doing
this?
try
{
// access service
//ans = return answer from service
//run calculations on answer
}
catch (Exception)
{
Console.WriteLine("Error in connecting to service");
}
This code works however takes forever to give up the try part of the
code.
Thank you
Rudiga