title: XmlTextReader - XML reading old content after file update
body: <hr>
  
  <p>So I am using a "<strong>Updater.exe</strong>" which is reading an <strong>XML</strong> file on my <strong>webserver</strong>. The Updater checks if a <strong>new version</strong> of the program is available who <strong>transfers</strong> the new file (replacing the old one) and runs it. (The file name is gibberish as i dont want users to run it directly, it has to go trough the updater (who runs it with the help of p.StartInfo.UseShellExecute = false;)).</p>
  
  <p>I have now encountered a really weird "bug" or how should i call this.</p>
  
  <p>Lets say i make a new version after 1 week. I update the assembly info of the application and the XML file version aswell. Now when i run the UPDATER.exe, <strong>he does not see</strong> the new <strong>updated XML content</strong>, telling him a new version is available. As i wanted to check the file trough my web browser it was also showing the OLD content (previous version) meaning, the application is UP to DATE which is false.</p>
  
  <p>After i pressed the "refresh" button in Chrome, the content i had displayed <strong>was updated</strong> and running the Updater.exe again <strong>worked fine</strong>.</p>
  
  <p>I do not have any IDEA what is actually going on. What does "refreshing" the page in the browser has to do with my application?</p>
  
  <p>Checking the XMLTextReader class from MSDN it says:</p>
  
  <p><strong><em>Represents a reader that provides fast, non-cached, forward-only access to XML data.</em></strong> So yeah, searching the internet telling me i should lookup for "caching" issues, makes me even more confused when i read the class description. After refreshing in the browser after such a long period of no updates, all next updates are working just fine. Seems that the "big pause" always makes this problem.</p>
  
  <p>Anyway, i would love to find a solution to this. Maybe it is just ME that has this problem. But i dont want to see this problem from the users using the application. They do not have time or knowledge to "refresh" anything. It just has to work.</p>
  
  <p>The XML example is here:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding = "utf-8" standalone="yes"?&gt;
  &lt;Application&gt;
      &lt;version&gt;2.0.0.16&lt;/version&gt;
      &lt;url&gt;http://server/folder/gibberish.extension&lt;/url&gt;
  &lt;/Application&gt;
  </code></pre>
  
  <p>And some code I use to read the XML.</p>
  
  <pre><code>Version newVersion = null;
  string xmlUrl = "http://server/folder/file.xml";
  
  XmlTextReader reader = null;
  try
  {
      reader = new XmlTextReader(xmlUrl);
      reader.MoveToContent();
      string elementName = "";
      if ((reader.NodeType == XmlNodeType.Element) &amp;&amp; (reader.Name == "Application"))
      {
          while (reader.Read())
          {
              if (reader.NodeType == XmlNodeType.Element)
              {
                  elementName = reader.Name;
              }
              else
              {
                  if ((reader.NodeType == XmlNodeType.Text) &amp;&amp; (reader.HasValue))
                  {
                      switch (elementName)
                      {
                          case "version":
                              newVersion = new Version(reader.Value);
                              break;
  
                              case "url":
                                  downloadUrl = reader.Value;
                                  break;
                      }
                  }
              }
          }
      }
  }
  catch (Exception ee)
  {
      //catch error
  }
  </code></pre>
  
  <p>I did my best to describe the problem as detailed as i can(with my simple knowledge in english language) here. And i searched the internet with no luck. I hope this will not result in a duplicate. IF you have any other questions, feel free to ask. I will definitely give you all the information you need to solve this weird puzzle.</p>
  
  <p>Best Regards, MiKE</p>