I am reading rss with xml reader.
And when url is bad it takes 60 seconds to fail for it. How i can specify timeout?
using (XmlReader reader = XmlReader.Create(url, settings))
I don't know if it's possible to change the XmlReader timeout, but maybe you can do something different:
Use WebRequest to get the xml (this does have a Timeout property) and feed XmlReader this xml after you have received it:
WebRequest request = WebRequest.Create(url);
request.Timeout = 5000;
using (WebResponse response = request.GetResponse())
using (XmlReader reader = XmlReader.Create(response.GetResponseStream()))
{
// Blah blah...
}
You can create your own WebRequest and create an XmlReader from the response stream. See the response to this question for details:
Prevent or handle time out with XmlReader.Create(uri)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With