Skip to main content

Latest Posts:

User’s Isolated Storage is lost when deploying a new version of your application
Entry Date: Apr 2009 keywords: Silverlight; VS 2008; .net framework 3.5; Visual Studio 2008;
Short Description:

Developing my Silverlight based dbschema tool I needed a way to let the users store their changes locally (e.g. internet connection is lost… save my changes somewhere please !), of course SL runs on a sandbox and in version 2 you cannot make a "save as" on a local computer (on version 3 yes), I could use some sort of javascript / server side custom http handler to work around it but sound to me like something crappy… then I found info about the Isolated Storage, cool stuff !!

As soon as I finished with my development I uploaded the changes and checked that the local save worked pretty well, so far so god, but somedays after that I just uploaded a new version of the application (a minor change, updating the size of some controls) and I realized that… MY FILES SAVED UNDER THE ISOLATED STORAGE WHERE GONE !!! AAAAGHHH !!!!

Entry:

Developing my Silverlight based dbschema tool I needed a way to let the users store their changes locally (e.g. internet connection is lost… save my changes somewhere please !), of course SL runs on a sandbox and in version 2 you cannot make a "save as" on a local computer (on version 3 yes), I could use some sort of javascript / server side custom http handler to work around it but sound to me like something crappy… then I found info about the Isolated Storage, cool stuff !!

As soon as I finished with my development I uploaded the changes and checked that the local save worked pretty well, so far so god, but somedays after that I just uploaded a new version of the application (a minor change, updating the size of some controls) and I realized that… MY FILES SAVED UNDER THE ISOLATED STORAGE WHERE GONE !!! AAAAGHHH !!!!

Is there any solution to this? Hopefully, The answer is yes… the isolated storage comes in two flavours:

  • Application Isolated Storage: exclusive for an individual application on a given site… this one is the evil, SL creates a new one for your application on every deploy. I would say just use this only for caching or temp stuff storage.
  • Site Isolated Storage: share the local storage at site level (if you have several XAP in your site the will share the same storage), … this one is the good one ! I have uploaded a new version of my app and this storage remains there, not wiped out, good stuff !! This one makes sense to let the user save info into his local storage.

How to create an instance of Site Iso Storage?

    
using System.IO.IsolatedStorage;

IsolatedStorageFile.GetUserStoreForSite()

More info about this on this forum thread.



Page (1) Of 1