Need Help: Common IsolatedStorage per user regardless of application

S

SteveM

I am writing a ToolUsage tracker which we will be accessing from each
of our custom written tools. It will basically capture various pieces
of information about the user, and the application they are using, and
then either store it directly in a database we have designated for
this purpose or if they are using the tool off-line and off-network,
it will store the data in a IsolatedStorage file, and then when the
user is connected to the network next usage will dump the
IsolatedStorage data out to the database. That in a nutshell is what I
am doing.

The problem I am having involves my understanding of IsolatedStorage I
am affraid. I want any tool that uses this ToolUsage library to track
its information to either store their data in a common IsolatedStorage
file, or failing that have a way to be able to find the various files
when the user accesses the library in a network connected mode:

Let me give an example:

TestA, TestB, TestC, TestD are independent executing programs
each of these have a using statement to instantiate a copy of a
library called ToolUsage. This library in turn uses Reflection and
StackFrame to gather information from the calling application. What
happens now is that there are 4 separate IsolatedStorage files
generated. That is all well and good but when I try to read back the
data from the IsolatedStorage file (even though it has the same file
name) I only get one of them.

I need a way of finding all of the IsolatedStorage files in
IsolatedStorage that have a specific name (so I can read out all the
data) or I need a way of specifying a single file to be used for this
type of application (accessing this library) where TestA, TestB,
TestC, TestD will all write out to a common file in IsolatedStorage
(perhaps per user).

My understanding indicates that each new execution will generate its
own IsolatedStorage folder/file

Is it possible to do what I want?

Thanks for all your help
-Steve
 
N

Nicholas Paldino [.NET/C# MVP]

Steve,

What I think you want to do here is when you are getting your
IsolatedStorageFile instance, you will want to call the static
GetMachineStoreForAssembly method on the IsolatedStorageFile class. This
will give you an isolated storage area that is scoped to the assembly that
makes the call to the GetMachineStoreForAssembly method.

Assuming that all of the calls to create the IsolatedStorageFile
instance are from the same assembly, you should consistently get the same
store back every time with this.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top