Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Sep 16, 2011 05:14 PM by rpeiro
Sep 16, 2011 05:14 PM|LINK
I really didn’t know on what forum I could post my question. Sorry If I’m the wrong forum. Anyway, I have a simple HTTPWebRequest and I set its Timeout property to 10 seconds like this:
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(“whateverIP”);
myRequest.Timeout = 10000; //in milliseconds
The thing is that even though I set the timeout to 10 seconds, for an invalid request (server not responding, too busy or unavailable) it still takes around 20 seconds to return an exception. I’ve been testing this scenario and definitely it takes way more
than my timeout value of 10 seconds to return an exception.
I would like to return the exception right after 10 seconds (set in timeout attribute) instead of 20. Is there a way to accomplish this? Any info is greatly appreciated. Thanks!