The WebClient class does not offer any property where u can set the timeout
period. If possible use the HttpWebrequest instead. The Webclient insternally
uses the webrequest class. In HttpWebrequest you can set the request timeout
property.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Endpoint);
//Endpoint is the URL to which u are making the request.
request.Method = "POST";
request.Credentials = CredentialCache.DefaultCredentials;
request.ContentType = "text/xml"; //depending on the data u are sending this
will change.
request.Timeout=<value in milliseconds>;
Can u give the complete code...I tried that URL on the browser and the
browser is giving 500 internal error. So it means that prior to this u need
to do some other things also like logging in etc.
you should be able to run this url on the browser.
The webclient call gets the response. However the httpwebrequest gets
System.Net.WebException.
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.