Prevent Silverlight xap from being cached by proxy server

前端 未结 2 550
小蘑菇
小蘑菇 2021-01-18 14:17

The company I work for has proxies/WAN accelerators between our international sites to cache Intranet web content. I have a Silverlight application being hosted on a server

相关标签:
2条回答
  • 2021-01-18 14:34

    If you want to make sure every time the xap file is retrieved and you don't want to worry about it - just use <param name="source" value="ClientBin/YourSilverlightapp.xap?<%=Guid.NewGuid().ToString() %>"/>

    of course - this lends itself to a heavier cache load. I do like the helper method above though if you only want changes to be propagated to the client.

    0 讨论(0)
  • 2021-01-18 14:55

    What I do is just add a querystring at the end of the path to the xap file. Then when you change the querystring variable, the proxies etc. should see it as a request to a new file. So far this has worked fine for me.

    So basically, when embedding an .xap in a straight-up HTML file, you would do this:

    <param name="source" value="ClientBin/SilverlightApplication1.xap?cachepreventer=whatevervalue"/>
    

    And then when you deploy a new version, just change "whatevervalue" to something else.

    EDIT
    If you need to use this technique in many places in your app I would read the querystring value from config and just write it to the page using asp.net. That way you only need to update it in one place when you deploy.

    0 讨论(0)
提交回复
热议问题