Silverlight Application, Caching and Updating dilema

2 posts, 0 answers
  1. Greg Duffield
    Greg Duffield avatar
    38 posts
    Member since:
    Feb 2006

    Posted 28 May 2009 Link to this post

    Im posting this up for discussion, advice and any thoughts really.

    I have been developing some silverlight components and applications for a while now and a problem that is becoming more prevalent is not being to roll out updated versions of my XAP files to the clients. The reason for the problem is that the Browsers are caching the XAP files, so if I drop a new version on the server this is not being picked up by the clients.

    I have looked at a number of recommendations including:-
    • Using Query String parameters on the source of the xap file
      This will only work if you are using absolute Uri's and if you are not using the asp:silverlight control to set the parameters
    • Using a custom HTTP Handler to stream the zap file to the client
      Then I have full control, but this just does not feel right.
    • Tell IIS not to cache the page/control
      The problem with this while it will give the updated XAP file you lose the benefit of already having the XAP on the client, as they have to download this everytime.

    Well thats where I am at the moment, and short of writing something into my controls to check something on the server etc Im not really sure where to go with this.

    Has anyone else experienced this, how did you get round it, what does Telerik recommend as a good approach for this.

    As always your help and advice would be much appreciated


  2. Hristo Deshev
    Hristo Deshev avatar
    559 posts

    Posted 30 May 2009 Link to this post

    Hi Greg Duffield,

    We had a similar problem with the classic ASP.NET controls -- browsers were caching the client scripts and stylesheets, and upgrading to a newer version sometimes caused problems for browsers with cached copies of an old script file.

    We solved the problem in the simplest way possible: we served the scripts off a folder with a version number in its path. That is if a page, index.aspx contained an ASP.NET component, it would load scripts from a path like ~/RadControls/RadXXX/Scripts/2.3.4/SomeScript.js. Whenever you upgrade to a newer version, the 2.3.4 part changes to 3.3.4 or something else, and browsers fetch the new version.

    You can do the same for your XAP files. Store them in a subfolder with the version string, and make the <object> tag on the host page look for the versioned path. You can go wild and automate that either with an ASP.NET server-side control or some build automation magic that will always make sure you refer to the latest XAP file.

    Hristo Deshev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft R3 2016 release webinar banner
Back to Top