This documentation is archived and is not being maintained.

Isolation by User and Assembly

When the assembly using the data store needs to be accessible from any application's domain, isolation by user and assembly is appropriate. Typically, in this situation, isolated storage is used to store data that applies across multiple applications and is not tied to any particular application, such as the user's name or license information. To access storage isolated by user and assembly, code must be trusted to transfer information between applications. Typically, isolation by user and assembly is allowed on intranets but not on the Internet. Calling the static GetStore method of IsolatedStorageFile and passing in a user and an assembly IsolatedStorageScope returns storage with this kind of isolation.

The following code example retrieves a store isolated by user and assembly. The store can be accessed through the isoFile object.

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

For an example using the evidence parameters, see IsolatedStorageFile.GetStore(IsolatedStorageScope, Evidence, Type, Evidence, Type).

The GetUserStoreForAssembly method is available as a shortcut, as shown in the following code example. This shortcut cannot be used to open stores capable of roaming; use GetStore in such cases.

IsolatedStorageFile isoFile = IsolatedStorageFile.GetUserStoreForAssembly();