Solved

Isolated Storage Question

Posted on 2003-11-03
6
535 Views
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.
0
Comment
Question by:jjacksn
  • 3
  • 3
6 Comments
 
LVL 6

Expert Comment

by:purpleblob
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.

i.e.      
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
0
 
LVL 5

Author Comment

by:jjacksn
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?
0
 
LVL 6

Accepted Solution

by:
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 :-)
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 5

Author Comment

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

Expert Comment

by:purpleblob
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.

0
 
LVL 5

Author Comment

by:jjacksn
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!
0

Featured Post

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!

Question has a verified solution.

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

Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…

679 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