title: Prevent or handle time out with XmlReader.Create(uri)
body: <p>Sometimes I am getting a time out exception when reading an XML via a URL. Is there something I can do to prevent this, or is this a problem with the remote server? Below is my simple code:</p>
  
  <pre><code>XmlDocument doc = new XmlDocument();
  doc.Load(XmlReader.Create(this.RssUrl));
  </code></pre>
  
  <p>I cam across a post that says KeepAlive may help, but I do not know how to pass that setting into the code above (or if that is even the correct solution): <a href="http://www.velocityreviews.com/forums/t95843-system-webexception-the-operation-has-timed-out.html" rel="nofollow noreferrer">http://www.velocityreviews.com/forums/t95843-system-webexception-the-operation-has-timed-out.html</a></p>
  
  <p>This is the exception, please help!</p>
  
  <pre><code>Exception Details: System.Net.WebException: The operation has timed out
  Stack Trace: 
  
  [WebException: The operation has timed out]
     System.Net.HttpWebRequest.GetResponse() +5375213
     System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials) +69
     System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) +3929371
     System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +54
     System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext) +144
     System.Xml.XmlReader.Create(String inputUri) +8
  </code></pre>