WebResponse timeout?

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Hi,
Is there any way of setting a time out for a webresponse.
I managed to cause our inhouse Webserver to not respond to a request.
The requesting code just sat there waiting patiently.
I would like it to be a little bit impatient and give up after n seconds.
Code snippet follows:
Thanks
Bob
HttpWebRequest r = (HttpWebRequest)WebRequest.Create(sURL);

Stream streamResponse;

HttpWebResponse response;



try

{


bool lValidTrans = false;

// Form the request

FormWebRequest(ref r, req);

// Get the response.

response = (HttpWebResponse)r.GetResponse();//Here we wait and wait and
wait...
 
Back
Top