Prevent Silverlight xap from being cached by proxy server

人盡茶涼 提交于 2019-12-01 17:13:07

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!