Isolated Storage in Silverlight is a good place to persist any kind of user preferences. The problem: You cannot rely on Isolated Storage being available.It can easily be turned of via the Silverlight context menu. ![image.axd?picture=isoStorage_thumb.jpg image.axd?picture=isoStorage_thumb.jpg](http://www.codeportrait.com/image.axd?picture=isoStorage_thumb.jpg)
Even when “Enable application storage” is checked you may still get an![image.axd?picture=isoStorageException_thumb.jpg image.axd?picture=isoStorageException_thumb.jpg](http://www.codeportrait.com/image.axd?picture=isoStorageException_thumb.jpg)
This can happen when private browsingis enabled (in all major browsers). Conclusion: Always check availability before accessing:if (IsolatedStorageFile.IsEnabled)
{
// read/write isolated storage data
}
else
{
// do something else
}
![image.axd?picture=isoStorage_thumb.jpg image.axd?picture=isoStorage_thumb.jpg](http://www.codeportrait.com/image.axd?picture=isoStorage_thumb.jpg)
Even when “Enable application storage” is checked you may still get an
![image.axd?picture=isoStorageException_thumb.jpg image.axd?picture=isoStorageException_thumb.jpg](http://www.codeportrait.com/image.axd?picture=isoStorageException_thumb.jpg)
This can happen when private browsingis enabled (in all major browsers). Conclusion: Always check availability before accessing:if (IsolatedStorageFile.IsEnabled)
{
// read/write isolated storage data
}
else
{
// do something else
}
Possible backup strategies:1. Use cookies?
Well, not really. Cookies are deleted when a private browsing session ends.2. Ask user? Read more: Code portrait
Well, not really. Cookies are deleted when a private browsing session ends.2. Ask user? Read more: Code portrait
0 comments:
Post a Comment