Making the Silverlight XAP file expire from browser cache programmatically

后端 未结 7 983
自闭症患者
自闭症患者 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条回答
  •  春和景丽
    2020-12-05 03:31

    The solution presented here is somewhat similar to Michael's but is automatic and guarantees the client will always get a new version. This may be inefficient depending on your situation.

    Since Lars says in his comments that he is not on Stack Overflow, I'm copying the response here.

    
    
      <%––––%>
    
      <%     
        string orgSourceValue = @"ClientBin/SilverlightApp.xap";     
        string param;
    
        if (System.Diagnostics.Debugger.IsAttached)     
        {
            param = "";
        }
        else     
        {     
          string xappath = HttpContext.Current.Server.MapPath(@"") + @"\" + orgSourceValue;
    
          DateTime xapCreationDate = System.IO.File.GetLastWriteTime(xappath);      
    
          param = "";     
        }
    
        Response.Write(param);     
      %>
    
      ....
    
    
    

提交回复
热议问题