Isolated Storage Question

Posted on 2003-11-03
Last Modified: 2013-11-15
I want to use Isolated Storage but have two different .exe have access to the same isolated storage.  Is this possible?  

I could just write the exact path into the registry, but I would think there is a better way to do this.  There Isolated storage is storing files about preferences/profiles and what not.  Mulitple applications I am writing need to have acces to it.
Question by:jjacksn
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3

Expert Comment

ID: 9674940
Yes it's possible to interact with a single isolated storage from multiple applications.

1. You need to use IsolatedStorageScope.User | IsolatedStorageScope.Assembly meaning that the any applications under the same user using the same assembly can access the isolated storage.

IsolatedStorageFile istore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null);

2. Now this is a bit more messy. You can is essence have isolated storage so it's domain, user and assembly specific or user and assmbly specific. Now to use the assembly specific option you'll need a single assembly to interact with the storage.

3. Due to the location appearing to be part of the identification proces your applications will need to use an assembly from one location. For example placing all EXE's and the assembly into a single folder.

An alternative might be, and I've not tried this, that you could have the assembly which interacts with the isolated storage in a folder of it's own and then interact with it using reflection (by loading it into your appdomain) thus meaning you needn't have all EXE's in the same folder.

Not sure if this is the only (or best way) of achieving what you want, but it does appear to work

Hope this helps

Author Comment

ID: 9683567
I am not really familiar with the notion of an Assembly.  What is one?  How do I ensure that two .exes both belong to the same assembly?

Accepted Solution

purpleblob earned 250 total points
ID: 9685147
Okay, well the MS help says

"An Assembly is a reusable, versionable, and self-describing building block of a common language runtime application"

But to put this in simply terms an EXE or a DLL is an assembly. It's not a case that both EXE belond to the same assembly but instead that both EXE's use the same assembly.

Okay, so to put this in real terms.

1. Create a Class library, this will create a DLL. Within the source for this class library put all you code for interacting with the isolated storage - now the code is in an assembly. Remembering that you use

IsolatedStorageFile istore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null);

2. Create your two  EXE's and add references to your class library assembly/DLL.
3. Interact with the classes method to do your isolated storage stuff.
4. Now when working with isolated storage make sure you EXE's are either in the same folder as the assembly (the easiest way of doing this) or loads the assembly into the EXE's AppDomain at runtime.

Basically isolated storage appears to differentiate between assemblies, even if it's the exact same DLL but in different folders - therefore the folder is encodes into the isolated storage - if you run storeadm.exe usually stored within the folder C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin (if you're running VS 2003 otherwise have a look in the SDK folder and find the BIN) you'll see this. Note: storeadm is a console app. so you'll probably be best running it from a Command prompt.

Hope this helps, post back and I'll see what I can do :-)
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 9685206
Hmmm, that's worrysome, because that is precisely how my code is currently setup.  let me go debug...

Expert Comment

ID: 9685258
Oh an amendment to my previous email - I forgot this option. I haven't tried it myself but it certainly should also work. If you store the DLL/Assembly with the isolated storage functionality in the GAC you will not need to put each EXE in the same folder as the DLL (or each other) and this SHOULD (remember I haven't tested this) allow both EXE's to work with the DLL - this will be much simpler than using reflection and AppDomains to load this DLL up from some location or other.


Author Comment

ID: 9685278
ah, of course.  I'm debugging the two exe to different folders, so they are copying the dll.  This should all be fixed when I put them together.  thanks!

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By default, Carbonite Server Backup manages your encryption key for you using Advanced Encryption Standard (AES) 128-bit encryption. If you choose to manage your private encryption key, your backups will be encrypted using AES 256-bit encryption.
The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question