IsolatedStorageFile.GetStore Method (IsolatedStorageScope, Type, Type)

 

Obtains isolated storage corresponding to the isolated storage scope given the application domain and assembly evidence types.

Namespace:   System.IO.IsolatedStorage
Assembly:  mscorlib (in mscorlib.dll)

public static IsolatedStorageFile GetStore(
	IsolatedStorageScope scope,
	Type domainEvidenceType,
	Type assemblyEvidenceType
)

Parameters

scope
Type: System.IO.IsolatedStorage.IsolatedStorageScope

A bitwise combination of the enumeration values.

domainEvidenceType
Type: System.Type

The type of the Evidence that you can chose from the list of Evidence present in the domain of the calling application. null lets the IsolatedStorage object choose the evidence.

assemblyEvidenceType
Type: System.Type

The type of the Evidence that you can chose from the list of Evidence present in the domain of the calling application. null lets the IsolatedStorage object choose the evidence.

Return Value

Type: System.IO.IsolatedStorage.IsolatedStorageFile

An object that represents the parameters.

Exception Condition
SecurityException

Sufficient isolated storage permissions have not been granted.

ArgumentException

The scope is invalid.

IsolatedStorageException

The evidence type provided is missing in the assembly evidence list.

-or-

An isolated storage location cannot be initialized.

-or-

scope contains the enumeration value Application, but the application identity of the caller cannot be determined, because the ActivationContext for the current application domain returned null.

-or-

scope contains the value Domain, but the permissions for the application domain cannot be determined.

-or-

scope contains Assembly, but the permissions for the calling assembly cannot be determined.

This is the overload of GetStore most likely to be called from application code.

This overload of GetStore opens an isolated store for the evidence types that are passed in.

System_CAPS_noteNote

If the scope parameter is Domain and the application domain in which the assembly is installed does not have IsolatedStorageFilePermission, the GetStore method will return an IsolatedStorageFile object without a quota. Later attempts to create an IsolatedStorageFile object using the IsolatedStorageFile object that does not have a quota will fail with an IsolatedStorageException.

The following code example demonstrates the GetStore method. For the complete context of this example, see the IsolatedStorageFile overview.


// Retrieve an IsolatedStorageFile for the current Domain and Assembly.
IsolatedStorageFile isoFile =
    IsolatedStorageFile.GetStore(IsolatedStorageScope.User |
    IsolatedStorageScope.Assembly |
    IsolatedStorageScope.Domain,
    null,
    null);

IsolatedStorageFileStream isoStream =
    new IsolatedStorageFileStream("substituteUsername",
    System.IO.FileMode.Open,
    System.IO.FileAccess.Read,
     System.IO.FileShare.Read);

IsolatedStorageFilePermission

for using isolated storage. Associated enumeration: AdministerIsolatedStorageByUser

ReflectionPermission

when invoked late-bound through mechanisms such as Type.InvokeMember. Associated enumeration: ReflectionPermissionFlag.MemberAccess

.NET Framework
Available since 1.1
Return to top
Show: