locked
Getting outdated responses from XDocument.Load() RRS feed

  • Question

  • In my win store app I use xml queries like this:

    XDocument.Load(uriForXmlFile);

    The problem is that I often get cached outdated responses. I'm unable to set WebRequest.DefaultCachePolicy, as this property is not supported for windows store apps.

    This is a nice hack that I'm using (adding a random string to the uri):

    XDocument.Load(uriForXmlFile + "?" + DateTime.Now.Ticks);
    Is there a more elegant way to do this?
    Perhaps one that will not totally bypass intermediate CDNs?
    Wednesday, November 6, 2013 1:25 PM

Answers

  • Unless the content provider sets a cache policy on the content, there isn't a better way to do this. 

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, November 6, 2013 3:05 PM
    Moderator