code_junkie

How do you force Firefox to not cache or re-download a Silverlight XAP file?

Nov 12th, 2011
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3. var versionNumber = Assembly.GetExecutingAssembly().GetName().Version.ToString();
  4. this.myApp.Source += "?" + versionNumber;
  5. }
  6.  
  7. <param name="source" value="ClientBin/App.xap?<%= DateTime.Now.Ticks %>" />
  8.  
  9. Cache-control: no-cache
  10. Pragma: no-cache
  11.  
  12. <?php $fdate = date("dHis",filemtime("MyApp.xap")) ?>
  13.  
  14. <param name="source" value="MyApp.xap?=<?php echo $fdate ?>"/>
  15.  
  16. var appTimestamp = '<%= System.IO.File.GetLastWriteTime(Server.MapPath("ClientBin/MyApp.xap")) %>';
  17. var source = 'ClientBin/MyApp.xap?appTimestamp=' + appTimestamp;
  18.  
  19. <param name="source" value="ClientBin/App.xap?<%= System.IO.File.GetLastWriteTime(Server.MapPath("ClientBin/App.xap")).ToString().GetHashCode()%>" />
  20.  
  21. <object id="Xaml1" data="data:application/x-silverlight-2," type="application/x-silverlight-2"
  22. width="100%" height="100%">
  23. <%––<param name="source" value="ClientBin/SilverlightApp.xap"/>––%>
  24. <%
  25. string orgSourceValue = @"ClientBin/SilverlightApp.xap";
  26. string param;
  27. if (System.Diagnostics.Debugger.IsAttached)
  28. param = "<param name="source" value="" + orgSourceValue + "" />";
  29. else
  30. {
  31. string xappath = HttpContext.Current.Server.MapPath(@"") + @"" + orgSourceValue;
  32. DateTime xapCreationDate = System.IO.File.GetLastWriteTime(xappath);
  33. param = "<param name="source" value="" + orgSourceValue + "?ignore="
  34. + xapCreationDate.ToString() + "" />";
  35. }
  36. Response.Write(param);
  37. %>
  38. <param name="onError" value="onSilverlightError"
  39.  
  40. <%
  41. const string sourceValue = @"ClientBin/MyXapFile.xap";
  42. string param;
  43.  
  44. if(System.Diagnostics.Debugger.IsAttached)
  45. param = "<param name="source" value="" + sourceValue + "" />";
  46. else
  47. {
  48. var xappath = HttpContext.Current.Server.MapPath(@"") + @"" + sourceValue;
  49. var xapCreationDate = System.IO.File.GetLastWriteTime(xappath);
  50.  
  51. param = "<param name="source" value="" + sourceValue + "?ignore="
  52. + xapCreationDate + "" />";
  53. }
  54. Response.Write(param);
  55. %>
  56.  
  57. <param name="source" value="ClientBin/MyXapFile.xap" />
  58.  
  59. <param name="source" value="app.xap?r12345"/>
Add Comment
Please, Sign In to add comment