Solved

Isolated Storage Question

Posted on 2003-11-03
6
537 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
[X]
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
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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Microsoft will be releasing the Windows 10 Creators Update in just a matter of weeks. Are you prepared? Follow these steps to ensure everything goes smoothly and you don't lose valuable data on your PC.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

615 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