I read data from xml file like this :
StringBuilder str = new StringBuilder();
str.Append("<News>");
XDocument xmlDoc = XDocument.Load(path);
var q = xmlDoc.Descendants("news")
.Where(x => x.Descendants("language_id") != null && x.Descendants("language_id").First().Value == "2")
.Select(x => x);
foreach (var st in q)
{
str.Append(st.ToString(SaveOptions.DisableFormatting) + " ");
}
str.Append("</News>");
return str.ToString();
but I note recently that when the xml file updated. It still reads the data from the old one !!! I don't know if it reads from a cashing copy or not .
When I reset the iis
it updates the data .
How to fix this problem?
Probably you need setup the DefaultCachePolicy.
WebRequest.DefaultCachePolicy = new
RequestCachePolicy(RequestCacheLevel.Revalidate);
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(myUri);
From here: http://www.pcreview.co.uk/forums/stop-xmldocument-load-using-cached-data-t3489418.html
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