Gets or sets the time-out value in milliseconds for the HttpWebRequest.GetResponse and HttpWebRequest.GetRequestStream methods.
A int indicating the number of milliseconds to wait for a response until the request times out, or System.Threading.Timeout.Infinite to indicate that the request does not time out.
Type Reason ArgumentOutOfRangeException A value less than zero and not equal to System.Threading.Timeout.Infinite is specified for a set operation.
HttpWebRequest.Timeout is the number of milliseconds that a subsequent synchronous request made with the HttpWebRequest.GetResponse method waits for a response, and the HttpWebRequest.GetRequestStream method waits for a stream. The HttpWebRequest.Timeout applies to the entire request and response, not individually to the HttpWebRequest.GetRequestStream and HttpWebRequest.GetResponse method calls. If the resource is not returned within the time-out period, the request throws a System.Net.WebException with the WebException.Status property set to WebExceptionStatus.Timeout.
The HttpWebRequest.Timeout property must be set before the HttpWebRequest.GetRequestStream or HttpWebRequest.GetResponse method is called. Changing the HttpWebRequest.Timeout property after calling the HttpWebRequest.GetRequestStream or HttpWebRequest.GetResponse method has no effect
The HttpWebRequest.Timeout property has no effect on asynchronous requests made with the HttpWebRequest.BeginGetResponse(AsyncCallback, object) or HttpWebRequest.BeginGetRequestStream(AsyncCallback, object) method.
In the case of asynchronous requests, the client application implements its own time-out mechanism. Refer to the example in the HttpWebRequest.BeginGetResponse(AsyncCallback, object) method.
To specify the amount of time to wait before a read or write operation times out, use the HttpWebRequest.ReadWriteTimeout property.
A Domain Name System (DNS) query may take up to 15 seconds to return or time out. If your request contains a host name that requires resolution and you set FileWebRequest.Timeout to a value less than 15 seconds, it may take 15 seconds or more before a System.Net.WebException is thrown to indicate a timeout on your request.