WebResponse timeout?

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top