Isolated storage introduced a new scope in v2.0 of the CLR to work with ClickOnce applications. Application scoped Isolated storage is backed by the application's data directory. This enables scenarios where your isolated storage data will flow forward with your application as ClickOnce updates it to new versions.
However, in order to take advantage of this, you need to be sure you're using the application scope. The default IsolatedStorageFileStream constructor will actually use domain scope, even if you are running in a ClickOnce application. (One design decision we could have made might have been to detect if this is a ClickOnce application and default to application scope, however this would lead to the situation where the program would have subtly different behavior if it was run as a standalone application.)
Since the default constructor is using domain scope, you might observe that as your application upgrades it appears that the files you stored in your isolated storage disappear. Because of this behavior, you'll want to specify that you'd like to use application scoped storage instead of domain scoped storage:
Note that application scoped isolated storage is only available if your program is running as a ClickOnce application. If it is not, you'll get an IsolatedStorageException when you call GetUserStoreForApplication which says "Unable to determine the application identity of the caller."
what is the solution to "If it is not, you'll get an IsolatedStorageException when you call GetUserStoreForApplication which says "Unable to determine the application identity of the caller."?
I am not using click-once. I have a small utility program that I use for myself and I will never distribute it. GetUserStoreForApplication will not work for me.
I am developing and deploying for testing a ClickOnce application on the same machine. I am using Application scope for IsolatedStorage and do not have a problem running in the debugger (VS2005-VB). (I assume it is because it was deployed to this machine.) However, I cannot run it by double clicking on the exe. How does the VB Host get around this?
I'm not sure, but one thing it may be doing is using an AppDomainManager to make the domain you're running in look like a ClickOnce domain.
-Shawn
PingBack from http://backyardshed.info/story.php?title=net-security-blog-isolated-storage-and-clickonce