SecurityPolicySection.TrustLevels Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the TrustLevels collection.
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
Property Value
A collection of TrustLevels objects.
- Attributes
Examples
The following code example demonstrates how to use the TrustLevels property, add a trust-level element to the configuration file, and update the configuration file. This code example is part of a larger example provided for the SecurityPolicySection class.
// 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"))
Remarks
The default values for the TrustLevels property are Full
, High
, Medium
, Low
, and Minimal
. The items of the TrustLevels collection each specify a security-level name and an associated policy file. You can extend the security system by providing your own named trust-level element mapped to a file specified by the policyFile
attribute. For information about creating trust-level elements, see trustLevel Element for securityPolicy (ASP.NET Settings Schema).
Applies to
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈