다음을 통해 공유


IsolatedStorageContainment 열거형

격리 저장소에 허용되는 용도를 지정합니다.

네임스페이스: System.Security.Permissions
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Enumeration IsolatedStorageContainment
‘사용 방법
Dim instance As IsolatedStorageContainment
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public enum IsolatedStorageContainment
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public enum class IsolatedStorageContainment
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public enum IsolatedStorageContainment
SerializableAttribute 
ComVisibleAttribute(true) 
public enum IsolatedStorageContainment

멤버

  멤버 이름 설명
AdministerIsolatedStorageByUser 사용자 저장소에 대한 무한 관리 기능입니다. 전체 사용자 저장소를 찾아 삭제할 수는 있지만 사용자의 고유한 도메인/어셈블리 ID 이외는 읽을 수 없습니다. 
ApplicationIsolationByMachine 저장소는 먼저 컴퓨터별로 격리된 다음 응용 프로그램별로 격리됩니다. 이 경우 모든 도메인 컨텍스트에서 액세스할 수 있는 응용 프로그램의 데이터 저장소가 만들어집니다. 응용 프로그램별 데이터 컴파트먼트는 특정 웹 사이트에서 응용 프로그램의 격리된 데이터를 노출시킬 수 있는 "터널"을 응용 프로그램 간에 제공할 수 있으므로 이러한 데이터 컴파트먼트에는 트러스트를 추가해야 합니다. 
ApplicationIsolationByRoamingUser 저장소는 먼저 사용자별로 격리된 다음 응용 프로그램 증명 정보별로 격리됩니다. Windows 사용자 데이터 로밍이 가능하도록 설정되어 있으면 저장소가 로밍됩니다. 이 경우 모든 도메인 컨텍스트에서 액세스할 수 있는 응용 프로그램의 데이터 저장소가 만들어집니다. 응용 프로그램별 데이터 컴파트먼트는 특정 웹 사이트에서 응용 프로그램의 격리된 데이터를 노출시킬 수 있는 "터널"을 응용 프로그램 간에 제공할 수 있으므로 이러한 데이터 컴파트먼트에는 트러스트를 추가해야 합니다. 
ApplicationIsolationByUser 저장소는 먼저 사용자별로 격리된 다음 응용 프로그램별로 격리됩니다. 또한 컴퓨터별로 격리되기도 합니다. 이 경우 모든 도메인 컨텍스트에서 액세스할 수 있는 응용 프로그램의 데이터 저장소가 만들어집니다. 응용 프로그램별 데이터 컴파트먼트는 특정 웹 사이트에서 응용 프로그램의 격리된 데이터를 노출시킬 수 있는 "터널"을 응용 프로그램 간에 제공할 수 있으므로 이러한 데이터 컴파트먼트에는 트러스트를 추가해야 합니다. 
AssemblyIsolationByMachine 저장소는 먼저 컴퓨터별로 격리된 다음 코드 어셈블리별로 격리됩니다. 이 멤버는 모든 도메인 컨텍스트에서 액세스할 수 있는 어셈블리에 대한 데이터 저장소를 제공합니다. 어셈블리별 데이터 컴파트먼트는 특정 웹 사이트에서 응용 프로그램의 격리된 데이터를 노출시킬 수 있는 "터널"을 응용 프로그램 간에 제공할 수 있으므로 어셈블리별 데이터 컴파트먼트에 트러스트를 추가해야 합니다. 
AssemblyIsolationByRoamingUser 저장소는 먼저 사용자별로 격리된 다음 어셈블리 증명 정보별로 격리됩니다. Windows 사용자 데이터 로밍이 가능하도록 설정되어 있으면 저장소가 로밍됩니다. 이 멤버는 모든 도메인 컨텍스트에서 액세스할 수 있는 어셈블리에 대한 데이터 저장소를 제공합니다. 어셈블리별 데이터 컴파트먼트는 특정 웹 사이트에서 응용 프로그램의 격리된 데이터를 노출시킬 수 있는 "터널"을 응용 프로그램 간에 제공할 수 있으므로 어셈블리별 데이터 컴파트먼트에 트러스트를 추가해야 합니다. 
AssemblyIsolationByUser 저장소는 먼저 사용자별로 격리된 다음 코드 어셈블리별로 격리됩니다. 또한 컴퓨터별로 격리되기도 합니다. 이 멤버는 모든 도메인 컨텍스트에서 액세스할 수 있는 어셈블리에 대한 데이터 저장소를 제공합니다. 어셈블리별 데이터 컴파트먼트는 특정 웹 사이트에서 응용 프로그램의 격리된 데이터를 노출시킬 수 있는 "터널"을 응용 프로그램 간에 제공할 수 있으므로 어셈블리별 데이터 컴파트먼트에 트러스트를 추가해야 합니다. 
DomainIsolationByMachine 저장소는 먼저 컴퓨터별로 격리된 다음 도메인과 어셈블리별로 격리됩니다. 같은 컴퓨터에서 실행하는 경우에만 같은 응용 프로그램의 컨텍스트에서 데이터에 액세스할 수 있습니다. 이는 타사 어셈블리에서 전용 데이터 저장소를 유지하려고 할 때 유용합니다. 
DomainIsolationByRoamingUser 저장소는 먼저 사용자별로 격리된 다음 도메인과 어셈블리별로 격리됩니다. Windows 사용자 데이터 로밍이 가능하도록 설정되어 있으면 저장소가 로밍됩니다. 데이터는 같은 응용 프로그램의 컨텍스트 안에서 같은 사용자가 실행할 때에만 액세스할 수 있습니다. 이는 타사 어셈블리에서 전용 데이터 저장소를 유지하려고 할 때 유용합니다. 
DomainIsolationByUser 저장소는 먼저 사용자별로 격리된 다음 도메인과 어셈블리별로 격리됩니다. 또한 컴퓨터별로 격리되기도 합니다. 데이터는 같은 응용 프로그램의 컨텍스트 안에서 같은 사용자가 실행할 때에만 액세스할 수 있습니다. 이는 타사 어셈블리에서 전용 데이터 저장소를 유지하려고 할 때 유용합니다. 
None 격리 저장소를 사용할 수 없습니다. 
UnrestrictedIsolatedStorage 격리 저장소를 제한 없이 사용할 수 있습니다. 도메인 또는 어셈블리의 ID에 관계 없이 사용자 저장소의 모든 부분에 대한 모든 액세스 권한이 코드에 있습니다. 격리 저장소의 이러한 용도에는 격리 저장소의 데이터 저장소의 콘텐츠를 열거하는 기능이 포함됩니다. 

설명

격리된 저장소는 증명 정보를 사용하여 응용 프로그램 또는 구성 요소에서 사용할 고유한 저장소 영역을 확인합니다. 어셈블리 ID는 해당 어셈블리에 사용할 가상 파일 시스템의 루트를 고유하게 결정합니다. 따라서 파일 시스템 또는 레지스트리와 같은 공용 리소스를 공유하는 여러 응용 프로그램 및 구성 요소와 달리 원래부터 할당된 고유한 파일 영역이 있습니다.

격리된 저장소를 할당할 때는 다음과 같은 네 가지 기본 격리 범위가 사용됩니다.

  • User - 항상 현재 사용자에 따라 코드의 범위가 지정됩니다. 같은 어셈블리는 다른 사용자가 실행할 경우 각기 다른 저장소를 받게 됩니다.

  • Machine - 항상 컴퓨터에 따라 코드의 범위가 지정됩니다. 같은 컴퓨터에서 서로 다른 사용자가 동일한 어셈블리를 실행할 경우 동일한 저장소가 사용됩니다.

  • Assembly - 강력한 이름(예: Microsoft.Office.* 또는 Microsoft.Office.Word), 게시자(공개 키 기반), URL(예: https://www.fourthcoffee.com/process/grind.htm), 사이트, 영역별로 암호화하여 코드를 식별합니다.

  • Domain - 응용 프로그램 도메인과 관련된 증명 정보를 기준으로 코드를 식별합니다. 웹 응용 프로그램 ID는 사이트의 URL에서 파생되거나 웹 페이지의 URL, 사이트 또는 영역에서 파생되고, 로컬 코드 ID는 응용 프로그램 디렉터리 경로에서 파생됩니다.

URL, 사이트 및 영역에 대한 정의는 UrlIdentityPermission, SiteIdentityPermissionZoneIdentityPermission을 참조하십시오.

이러한 ID는 그룹화되어 원하는 격리 저장소가 만들어질 때까지 하나씩 차례로 적용됩니다. 올바른 그룹화는 사용자+어셈블리 및 사용자+어셈블리+도메인입니다. 이러한 ID 그룹화는 여러 응용 프로그램에 유용합니다.

데이터를 도메인, 사용자 및 어셈블리별로 저장하면 해당 어셈블리의 코드에서만 데이터에 액세스할 수 있다는 점에서 전용 데이터라고 할 수 있습니다. 또한, 데이터 저장소는 어셈블리를 실행하는 응용 프로그램에서 격리되므로 데이터가 다른 응용 프로그램에 노출되어 누수될 가능성이 없습니다.

어셈블리 및 사용자별 격리는 여러 응용 프로그램에 적용되는 라이센스 정보 또는 응용 프로그램과는 관계 없는 사용자의 개인 정보(예: 이름, 인증 자격 증명) 등의 사용자 데이터에 사용할 수 있습니다.

IsolatedStorageContainment는 응용 프로그램에 격리 저장소를 사용할 수 있는지 여부 및 사용할 수 있다면 가능한 ID 조합을 결정하는 플래그를 표시하며, 응용 프로그램에서 사용자와 함께 로밍되는 위치에 정보를 저장할 수 있는지 여부도 결정합니다(Windows 로밍 사용자 프로필 또는 폴더 리디렉션을 구성해야 함).

예제

이 예제에서는 이 어셈블리의 코드에 IsolatedStoragePermission이 필요함을 CLR에 알리는 방법과 격리된 저장소에 대해 쓰기와 읽기를 수행하는 방법을 보여 줍니다.

using System;
using System.Security.Permissions;
using System.IO.IsolatedStorage;
using System.IO;

// Notify the CLR to grant this assembly the IsolatedStorageFilePermission. 
// This allows the assembly to work with storage files that are isolated 
// by user and assembly.
[assembly: IsolatedStorageFilePermission(SecurityAction.RequestMinimum, UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByUser)]

public sealed class App
{
    static void Main()
    {
        // Attempt to create a storage file that is isolated by user and assembly.
        // IsolatedStorageFilePermission granted to the attribute at the top of this file 
        // allows CLR to load this assembly and execution of this statement.
        using (Stream s = new IsolatedStorageFileStream("AssemblyData", FileMode.Create, IsolatedStorageFile.GetUserStoreForAssembly()))
        {
         
             // Write some data out to the isolated file.
             using (StreamWriter sw = new StreamWriter(s))
             {
                sw.Write("This is some test data.");
             }
        }

        // Attempt to open the file that was previously created.
        using (Stream s = new IsolatedStorageFileStream("AssemblyData", FileMode.Open, IsolatedStorageFile.GetUserStoreForAssembly()))
        {
             // Read the data from the file and display it.
             using (StreamReader sr = new StreamReader(s))
             {
                 Console.WriteLine(sr.ReadLine());
             }
        }
    }
}

// This code produces the following output.
//
//  Some test data.
using namespace System;
using namespace System::Security;
using namespace System::Security::Permissions;
using namespace System::IO::IsolatedStorage;
using namespace System::IO;

// Notify the CLR to grant this assembly the IsolatedStorage-
// FilePermission. This allows the assembly to work with storage
// files that are isolated by user and assembly.
[assembly: IsolatedStorageFilePermission(
    SecurityAction::RequestMinimum, UsageAllowed =
    IsolatedStorageContainment::AssemblyIsolationByUser)];
int main()
{
    try
    {
        // Attempt to create a storage file that is isolated by
        // user and assembly. IsolatedStorageFilePermission
        // granted to the attribute at the top of this file
        // allows CLR to load this assembly and execution of this
        // statement.
        Stream^ fileCreateStream = gcnew
            IsolatedStorageFileStream(
            "AssemblyData",
            FileMode::Create,
            IsolatedStorageFile::GetUserStoreForAssembly());

        StreamWriter^ streamWriter = gcnew StreamWriter(
            fileCreateStream);
        try
        {
            // Write some data out to the isolated file.

            streamWriter->Write("This is some test data.");
            streamWriter->Close();   
        }
        finally
        {
            delete fileCreateStream;
            delete streamWriter;
        } 
    }
    catch (IOException^ ex)
    {
        Console::WriteLine(ex->Message);
    }

    try
    {
        Stream^ fileOpenStream =
            gcnew IsolatedStorageFileStream(
            "AssemblyData",
            FileMode::Open,
            IsolatedStorageFile::GetUserStoreForAssembly());
        // Attempt to open the file that was previously created.

        StreamReader^ streamReader = gcnew StreamReader(
            fileOpenStream);
        try
        { 
            // Read the data from the file and display it.

            Console::WriteLine(streamReader->ReadLine());
            streamReader->Close();
        }
        finally
        {
            delete fileOpenStream;
            delete streamReader;
        }
    }
    catch (FileNotFoundException^ ex)
    {
        Console::WriteLine(ex->Message);
    }
    catch (IOException^ ex)
    {
        Console::WriteLine(ex->Message);
    }
}

// This code produces the following output.
//
//  This is some test data.

플랫폼

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

System.Security.Permissions 네임스페이스
IsolatedStoragePermission
IsolatedStoragePermissionAttribute
IsolatedStorageFilePermission
IsolatedStorageFilePermissionAttribute

기타 리소스

격리된 저장소