Re: Refreshing an SL4 app (client problem?)
+1 to Stephen I found this in my blog post draft folder body form id=form1 runat=server style=height:100% div id=silverlightControlHost object data=data:application/x-silverlight-2, type=application/x-silverlight-2 width=100% height=100% % const string filename = @ClientBin/SilverlightApplication2.xap; string version = (new System.IO.FileInfo(Server.MapPath(filename))).LastWriteTime.ToString(MMddhhmmss); Response.Write( param name=\source\ value=\ + filename + ? + version + \ /); % param name=onError value=onSilverlightError / param name=background value=white / param name=minRuntimeVersion value=4.0.50826.0 / param name=autoUpgrade value=true / a href= http://go.microsoft.com/fwlink/?LinkID=149156v=4.0.50826.0; style=text-decoration:none img src=http://go.microsoft.com/fwlink/?LinkId=161376; alt=Get Microsoft Silverlight style=border-style:none/ /a /objectiframe id=_sl_historyFrame style=visibility:hidden;height:0px;width:0px;border:0px/iframe/div /form /body And add at the top of that ASPX, in order to avoid caching of the hosting ASPX % Response.Expires = -1; Response.AddHeader(Pragma, no-cache); Response.AddHeader(cache-control, no-store); % .peter.gfader. (current mood = happy) http://blog.gfader.com On Thu, Sep 8, 2011 at 7:15 AM, Stephen Price step...@littlevoices.comwrote: Ah didn't see this other thread. If you use the last modified time of the xap file then you will download the new version and if its updated then you automatically get the new one, but don't download it every time (which would happen if the url was different on every page load.) you only want the client to download it if the xap file has changed. put the modified date/time in the url and forget about it. move on to more interesting problems. :) On Thu, Sep 8, 2011 at 12:12 PM, Greg Keogh g...@mira.net wrote: http://stackoverflow.com/questions/2281919/expiry-silverlight-xap-file-from-browser-cache-programmatically ** ** Interesting ... some solutions are browser specific, some need code and maintenance. Adding the “Cache-Control: no-cache” header seems the easiest by far, so I’ll try it out at the app level (it’s under the IIS – HTTP Response Headers). I’m not feeling confident. ** ** Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight -- .peter.gfader. Current mood = happy! Check this before you go live http://blog.gfader.com/2011/07/website-check-list-part-1-aspnet-4.html ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Refreshing an SL4 app (client problem?)
I have used this approach too. I actually have a Build.txt in the root of the application, and set the build number in the web.config and I use: App.xap?v=2.0.0.1 The query string difference is also enough to invalidate the cache, and it can be put into the build process easily and only invalidates on a new build. Regards, Jake Ginnivan Readify | Senior Developer | MVP (VSTO) M: +61 403 846 400 | E: jake.ginni...@readify.netmailto:jake.ginni...@readify.net | W: www.readify.nethttp://www.readify.net/ From: ozsilverlight-boun...@ozsilverlight.com [mailto:ozsilverlight-boun...@ozsilverlight.com] On Behalf Of Simon Hammer Sent: Thursday, 8 September 2011 12:07 PM To: ozSilverlight Subject: RE: Refreshing an SL4 app (client problem?) Hi Greg, Funny, I was dealing with this today We handle this by having a version number in the xap filename (eg. SLAppName1.5.2.xap). This way whenever a new build goes on production, we know browsers will referencing the correct one. Simon. From: Chris Anderson [mailto:christheco...@gmail.com]mailto:[mailto:christheco...@gmail.com] Sent: Thursday, 8 September 2011 2:02 PM To: ozSilverlight Subject: Re: Refreshing an SL4 app (client problem?) It's because the browser is caching the app, and your IIS probably doesn't set any cache expiry headers. Here's some info: http://stackoverflow.com/questions/2281919/expiry-silverlight-xap-file-from-browser-cache-programmatically Chris On 8 September 2011 13:58, Greg Keogh g...@mira.netmailto:g...@mira.net wrote: Well I should have asked my cat, because I browsed to the SL4 app from the outside world and it was the latest version. When browsing from my work machine I see the old version. So I restart my localhost IIS and delete temporary files in the browser, but it makes no difference. As an administrator I delete all local v2 and v4 ASP.NEThttp://ASP.NET temporary files and restart IIS, now it's fixed. So it looks like the problem was on my client side, not on the server machine side. I'm not sure which step fixed the problem, but it *might* have been deleting the local temporary files. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.commailto:ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Re: Re: Refreshing an SL4 app
A lazy way to avoid this is to always rename the xap file each version. Alternatively, In IIS you can specify the no-cache header for the xap file, however that means that it is always downloaded even when you would prefer the user gets a cached one (from either their browser cache, asp.net cache, or proxy caches etc along the way). Another way which I am pretty sure works but I haven't used for a while, is to add a dummy param to your silverlight object in html / aspx eg : param name=source value=ClientBin/SomeApplication.xap?ver=23/ Everytime you release a new version, change ver= to a new value, which will prevent caching issues. On , Stephen Price step...@littlevoices.com wrote: hehe, re-read your email and you did say it was SL4 app, so yeah, its probably what I said. :) On Thu, Sep 8, 2011 at 1:09 PM, Stephen Price step...@littlevoices.com wrote: sounds like it may be the client machine caching the xap file. If that is your problem, if you clear the cache on the client machine and it then downloads the new xap file then the fix for this (one I've used anyway) is to append the modified date/time to the end of the url. So basically when ever the xap file is updated then the browser will think its been given a new url and so downloads it (and caches that new one.). Same app, but different/unique url. I'm assuming its a Silverlight app, given you've posted it here. :) if you can't find example code of appending the modified date let me know, I've got it kicking around somewhere at home. I'm sure its out there tho. cheers, Stephen On Thu, Sep 8, 2011 at 11:46 AM, Greg Keogh g...@mira.net wrote: Folks, I have this random problem where I xcopy deploy all of my app files over to my Win2008 server box and the updated SL4 app doesn't appear, I get the previous version. I have spent hours over the previous months trying to figure this problem out. I restart IIS, I even reboot, I delete the 'Temporary ASP.NET Files' folders and I do a voodoo dance, but nothing will make the new app appear. Sometimes after another wasted half hour of stuffing around it suddenly comes good. But as is the new tradition of software development: I don't know what went wrong and I don't know what goes right. Anyone else suffered this and sorted it out? Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Refreshing an SL4 app
Folks, I have this random problem where I xcopy deploy all of my app files over to my Win2008 server box and the updated SL4 app doesn't appear, I get the previous version. I have spent hours over the previous months trying to figure this problem out. I restart IIS, I even reboot, I delete the 'Temporary ASP.NET Files' folders and I do a voodoo dance, but nothing will make the new app appear. Sometimes after another wasted half hour of stuffing around it suddenly comes good. But as is the new tradition of software development: I don't know what went wrong and I don't know what goes right. Anyone else suffered this and sorted it out? Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Refreshing an SL4 app (client problem?)
Well I should have asked my cat, because I browsed to the SL4 app from the outside world and it was the latest version. When browsing from my work machine I see the old version. So I restart my localhost IIS and delete temporary files in the browser, but it makes no difference. As an administrator I delete all local v2 and v4 ASP.NET temporary files and restart IIS, now it's fixed. So it looks like the problem was on my client side, not on the server machine side. I'm not sure which step fixed the problem, but it *might* have been deleting the local temporary files. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Refreshing an SL4 app (client problem?)
http://stackoverflow.com/questions/2281919/expiry-silverlight-xap-file-from- browser-cache-programmatically Interesting ... some solutions are browser specific, some need code and maintenance. Adding the Cache-Control: no-cache header seems the easiest by far, so I'll try it out at the app level (it's under the IIS - HTTP Response Headers). I'm not feeling confident. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Re: Refreshing an SL4 app
hehe, re-read your email and you did say it was SL4 app, so yeah, its probably what I said. :) On Thu, Sep 8, 2011 at 1:09 PM, Stephen Price step...@littlevoices.comwrote: sounds like it may be the client machine caching the xap file. If that is your problem, if you clear the cache on the client machine and it then downloads the new xap file then the fix for this (one I've used anyway) is to append the modified date/time to the end of the url. So basically when ever the xap file is updated then the browser will think its been given a new url and so downloads it (and caches that new one.). Same app, but different/unique url. I'm assuming its a Silverlight app, given you've posted it here. :) if you can't find example code of appending the modified date let me know, I've got it kicking around somewhere at home. I'm sure its out there tho. cheers, Stephen On Thu, Sep 8, 2011 at 11:46 AM, Greg Keogh g...@mira.net wrote: Folks, I have this random problem where I xcopy deploy all of my app files over to my Win2008 server box and the updated SL4 app doesn’t appear, I get the previous version. ** ** I have spent hours over the previous months trying to figure this problem out. I restart IIS, I even reboot, I delete the ‘Temporary ASP.NET Files’ folders and I do a voodoo dance, but nothing will make the new app appear. Sometimes after another wasted half hour of stuffing around it suddenly comes good. But as is the new tradition of software development: I don’t know what went wrong and I don’t know what goes right. ** ** Anyone else suffered this and sorted it out? ** ** Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight