问题描述
在使用 Silverlight 时,我注意到 Firefox 会缓存 XAP 文件,因此如果我进行更新,用户可能会使用过时的版本.有没有办法强制浏览器每次重新下载 XAP 文件,或者仅在发布更新后才强制重新下载?或者 Silverlight 配置中是否有一项设置可以阻止浏览器完全缓存 XAP 文件?
When working with Silverlight, I've noticed that Firefox will cache the XAP file, so if I do an update, a user may be stuck using an outdated version. Is there a way to force the browser to either re-download the XAP file every time, or maybe only force it to after an update has been published? Or is there a setting in the Silverlight config that stops the browser from caching the XAP file altogether?
谢谢,杰夫
推荐答案
查询字符串工作正常,但我不会使用 DateTime.Now,因为它强制用户重新下载应用程序每次.相反,我们使用以下内容:
The query string works perfectly, but I wouldn't use DateTime.Now, because it forces the user to re-download the app every time. Instead, we use the following:
protected void Page_Load(object sender, EventArgs e)
{
var versionNumber = Assembly.GetExecutingAssembly().GetName().Version.ToString();
this.myApp.Source += "?" + versionNumber;
}
这样您只需增加 AssemblyInfo.cs 文件中的版本号.
This way all you have to do is increment the version number in the AssemblyInfo.cs file.
这篇关于如何强制 Firefox 不缓存或重新下载 Silverlight XAP 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!