Isolated Storage Question

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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
jjacksnAuthor Commented:
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?
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 :-)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

jjacksnAuthor Commented:
Hmmm, that's worrysome, because that is precisely how my code is currently setup.  let me go debug...
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.

jjacksnAuthor Commented:
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!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Storage Software

From novice to tech pro — start learning today.