Results 1 to 4 of 4

Thread: Set time out on XmlTextReader

  1. #1

    Thread Starter
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Set time out on XmlTextReader

    I have the following code which takes a news feed from a remote website and loads it into a DataSet.

    However I'm having problems when the feed times out - rather than throwing an error that is caught by the try catch block it just throws a time out error for the whole application.

    Code:
    XmlTextReader _xmlReader = new XmlTextReader(ConfigurationSettings.AppSettings["NewsXmlFeedUrl"]);
    DataSet _dsStories = new DataSet();
    _dsStories.ReadXml(_xmlReader);
    How can I extend this so I can specify a time out for the XmlTextReader?

    Cheers

    DJ

    If I have been helpful please rate my post. If I haven't tell me!

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Set time out on XmlTextReader

    Could you not do an HttpWebRequest instead where you can specify a timeout?

  3. #3

    Thread Starter
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: Set time out on XmlTextReader

    I expect so but I'm sure the steps needed to get the XML from the HttpWebRequest into the DataSet.

    Any help appreciated.

    If I have been helpful please rate my post. If I haven't tell me!

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Set time out on XmlTextReader

    Internally, the XmlTextReader uses HttpWebRequest anyways. I checked MSDN, there's nothing that you can use to set a timeout. Poorly documented class.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width