Share via


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

プロパティ値

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、、 HighMediumLowおよび Minimalです。 コレクションの各項目は、 TrustLevels セキュリティ レベルの名前と関連付けられたポリシー ファイルを指定します。 属性で指定されたファイルにマップされた独自の名前付き信頼レベル要素を指定することで、セキュリティ システムを policyFile 拡張できます。 信頼レベルの要素の作成の詳細については、securityPolicy の trustLevel 要素 (ASP.NET 設定 スキーマ) を参照してください。

適用対象