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.

Dim isoFile As IsolatedStorageFile = _
    IsolatedStorageFile.GetStore(IsolatedStorageScope.User Or _
        IsolatedStorageScope.Assembly, Nothing, Nothing)
IsolatedStorageFile isoFile =
    IsolatedStorageFile.GetStore(IsolatedStorageScope.User |
    IsolatedStorageScope.Assembly, null, null);
IsolatedStorageFile^ isoFile =
    IsolatedStorageFile::GetStore(IsolatedStorageScope::User |
        IsolatedStorageScope::Assembly, (Type^)nullptr, (Type^)nullptr);

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.

Dim isoFile As IsolatedStorageFile = _
IsolatedStorageFile isoFile = IsolatedStorageFile.GetUserStoreForAssembly();
IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetUserStoreForAssembly();

See Also




Types of Isolation

Isolation by User, Domain, and Assembly

Other Resources

Isolated Storage