Comment out Index. aspx
The code is as follows: |
Copy code |
<Param name = "source" value = "ClientBin/xxxxxx. xap"/> |
Add the following C # code:
The code is as follows: |
Copy code |
<% // Modify 2011.11.07 to solve the xap cache problem String strSourceFile = @ "ClientBin/xxxxxx. xap "; String param; If (System. Diagnostics. Debugger. IsAttached) Param = "<param name =" source "value =" "+ strSourceFile +" "/> "; Else { String xappath = HttpContext. Current. Server. MapPath (@ "") + @ "" + strSourceFile; DateTime xapCreationDate = System. IO. File. GetLastWriteTime (xappath ); Param = "<param name =" source "value =" "+ strSourceFile + "? Ignore =" + XapCreationDate. ToString () + ""/> "; } Response. Write (param ); %>
|
When the xap is updated, the last modification time of the xap file is used to determine whether the xap is a newly generated xap, so as to control whether to read the xap in the cache or download the xap on the server.
Reference: http://codeblog.larsholm.net/2010/02/avoid-incorrect-caching-of-silverlight-xap-file/