다음을 통해 공유


SectionDefinition.AllowDefinition 속성

정의

구성 섹션의 유효한 구성 경로 위치를 나타내는 값을 가져오거나 설정합니다.

public:
 property System::String ^ AllowDefinition { System::String ^ get(); void set(System::String ^ value); };
public string AllowDefinition { get; set; }
member this.AllowDefinition : string with get, set
Public Property AllowDefinition As String

속성 값

구성 경로 위치입니다.

예제

다음 예제는 AllowDefinition 속성입니다.


using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Web.Administration;
using Microsoft.Web.Management;

namespace AdministrationSnippets
{
    public class AdministrationSectionDefinition
    {
        // List all configuration sections in applicationHost.config
        public void ShowAllSections()
        {
            ServerManager manager = new ServerManager();
            SectionGroup rootGroup = 
                manager.GetApplicationHostConfiguration().RootSectionGroup;
            ShowGroup(rootGroup, -1);

        }

        private void ShowGroup(SectionGroup group, int indentLevel)
        {
            Console.Write("".PadLeft(++indentLevel, ' '));
            string grpName = String.IsNullOrEmpty(group.Name) ? "{root}" : group.Name;
            Console.WriteLine("+ Section Group: {0}; Sub-groups: {1}; Sections: {2}",
                grpName, group.SectionGroups.Count, group.Sections.Count);

            foreach (SectionGroup grp in group.SectionGroups)
            {
                ShowGroup(grp, indentLevel);
            }

            string path = String.Concat(group.Name, "/");

            foreach (SectionDefinition def in group.Sections)
            {
                Console.Write("".PadLeft(indentLevel, ' '));
                Console.WriteLine("|_Name:                {0}", String.Concat(path,def.Name));
                Console.Write("".PadLeft(indentLevel, ' '));
                Console.WriteLine("|_AllowDefinition:     {0}", def.AllowDefinition);
                Console.Write("".PadLeft(indentLevel, ' '));
                Console.WriteLine("|_AllowLocation:       {0}", def.AllowLocation);
                Console.Write("".PadLeft(indentLevel, ' '));
                Console.WriteLine("|_OverrideModeDefault: {0}", def.OverrideModeDefault);
                Console.Write("".PadLeft(indentLevel, ' '));
                Console.WriteLine("|_Type:                {0}\r\n", 
                    String.IsNullOrEmpty(def.Type) ? "null" : def.Type);
            }
        }

    }
}

설명

다음 표에서는 속성에 유효한 값을 나열합니다 AllowDefinition .

정의
"모든 곳" 섹션은 모든 구성 수준에서 정의할 수 있습니다. 기본값입니다.
"MachineToApplication" 섹션은 Machine.config 또는 ApplicationHost.config 파일에서 정의할 수 있습니다.
"MachineOnly" 섹션은 Machine.config 파일에서만 정의할 수 있습니다.
"MachineToWebRoot" 섹션은 Machine.config, ApplicationHost.config 또는 Web.config 파일에서 정의할 수 있습니다. Web.config 파일은 웹 사이트 루트에 저장됩니다.
"AppHostOnly" 섹션은 ApplicationHost.config 파일에서만 정의할 수 있습니다.

적용 대상