다음을 통해 공유


SecurityPolicySection.TrustLevels 속성

정의

TrustLevels 컬렉션을 가져옵니다.

public:
 property System::Web::Configuration::TrustLevelCollection ^ TrustLevels { System::Web::Configuration::TrustLevelCollection ^ get(); };
[System.Configuration.ConfigurationProperty("", IsDefaultCollection=true)]
public System.Web.Configuration.TrustLevelCollection TrustLevels { get; }
[<System.Configuration.ConfigurationProperty("", IsDefaultCollection=true)>]
member this.TrustLevels : System.Web.Configuration.TrustLevelCollection
Public ReadOnly Property TrustLevels As TrustLevelCollection

속성 값

TrustLevels 개체 컬렉션입니다.

특성

예제

다음 코드 예제에서는 속성을 사용 하 여 TrustLevels 구성 파일에 신뢰 수준 요소를 추가 하 고 구성 파일을 업데이트 하는 방법을 보여 줍니다. 이 코드 예제는 클래스에 제공된 더 큰 예제의 SecurityPolicySection 일부입니다.

// Display elements of the TrustLevels collection property.
for (int i = 0; i < configSection.TrustLevels.Count; i++) 
{
  Console.WriteLine();
  Console.WriteLine("TrustLevel {0}:", i);
  Console.WriteLine("Name: {0}", 
    configSection.TrustLevels.Get(i).Name);
  Console.WriteLine("Type: {0}", 
    configSection.TrustLevels.Get(i).PolicyFile);
}

// Add a TrustLevel element to the configuration file.
configSection.TrustLevels.Add(new TrustLevel("myTrust", "mytrust.config"));
' Display elements of the TrustLevels collection property.
For i As Integer = 0 To (configSection.TrustLevels.Count - 1)
  Console.WriteLine()
  Console.WriteLine("TrustLevel {0}:", i)
  Console.WriteLine("Name: {0}", _
   configSection.TrustLevels.Get(i).Name)
  Console.WriteLine("Type: {0}", _
   configSection.TrustLevels.Get(i).PolicyFile)
Next i

' Add a TrustLevel element to the configuration file.
configSection.TrustLevels.Add(New TrustLevel("myTrust", "mytrust.config"))

설명

속성의 TrustLevels 기본값은 Full, High, MediumLowMinimal. 컬렉션의 TrustLevels 항목은 각각 보안 수준 이름과 연결된 정책 파일을 지정합니다. 특성으로 지정된 파일에 매핑된 고유한 명명된 policyFile 신뢰 수준 요소를 제공하여 보안 시스템을 확장할 수 있습니다. 신뢰 수준 요소를 만드는 방법에 대한 자세한 내용은 securityPolicy에 대한 trustLevel 요소(ASP.NET 설정 스키마)를 참조하세요.

적용 대상