다음을 통해 공유


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 isoStore As IsolatedStorageFile
isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User Or IsolatedStorageScope.Assembly, Nothing, Nothing)
[C#]
IsolatedStorageFile isoFile = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null);

Another 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 isoStore As IsolatedStorageFile
isoStore = IsolatedStorageFile.GetUserStoreForAssembly()
[C#]
IsolatedStorageFile isoFile = IsolatedStorageFile.GetUserStoreForAssembly();

See Also

Types of Isolation | Isolation by User, Domain, and Assembly | Performing Isolated Storage Tasks