Making the Silverlight XAP file expire from browser cache programmatically

后端 未结 7 980
自闭症患者
自闭症患者 2020-12-05 02:42

How to do I prevent a Silverlight XAP file being cached by the web browser?

The reason I want to do this is during development I don\'t want to manually clear the br

7条回答
  •  -上瘾入骨i
    2020-12-05 03:30

    I added a query parm to the path of the xap file, so that I can manage it through Versioning.

    Default.aspx code:

    
    

    Default.aspx.cs code:

    protected string XapID
    {
        get
        {
            Version v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
    
            if (System.Diagnostics.Debugger.IsAttached)
                Response.Write(string.Format("Build: {0}.{1}.{2}.{3}", v.Major.ToString(), v.Minor.ToString(), v.Build.ToString(), v.Revision.ToString()));
            return string.Format("{0}.{1}.{2}.{3}", v.Major.ToString(), v.Minor.ToString(), v.Build.ToString(), v.Revision.ToString()
        }
    }
    

提交回复
热议问题