이 문서는 기계로 번역한 것입니다. 원본 텍스트를 보려면 포인터를 문서의 문장 위로 올리십시오. 추가 정보
번역
원본
이 항목은 아직 평가되지 않았습니다.- 이 항목 평가

PagesSection 클래스

이 클래스를 사용하면 구성 파일의 페이지 섹션에 프로그래밍 방식으로 액세스할 수 있습니다. 이 클래스는 상속될 수 없습니다.

네임스페이스:  System.Web.Configuration
어셈블리:  System.Web(System.Web.dll)
public sealed class PagesSection : ConfigurationSection

PagesSection 형식에서는 다음과 같은 멤버를 노출합니다.

  이름설명
Public 메서드PagesSection인프라입니다. 기본 설정을 사용하여 PagesSection 클래스의 새 인스턴스를 초기화합니다.
위쪽
  이름설명
Public 속성AsyncTimeout페이지를 비동기적으로 처리하는 동안 비동기 처리기가 완료될 때까지 기다릴 시간(초)을 나타내는 값을 가져오거나 설정합니다.
Public 속성AutoEventWireupASP.NET 페이지의 이벤트가 이벤트 처리 함수에 자동으로 연결되는지 여부를 나타내는 값을 가져오거나 설정합니다.
Public 속성Buffer.aspx 페이지 및 .ascx 컨트롤에서 응답 버퍼링을 사용하는지 여부를 지정하는 값을 가져오거나 설정합니다.
Public 속성ClientIDMode컨트롤의 식별자를 생성하는 데 사용되는 기본 알고리즘을 가져오거나 설정합니다.
Public 속성CompilationMode.aspx 페이지와 .ascx 컨트롤이 컴파일되는 방식을 결정하는 값을 가져오거나 설정합니다.
Public 속성ControlRenderingCompatibilityVersion렌더링된 어떠한 HTML과도 호환되는 ASP.NET 버전을 지정하는 값을 가져오거나 설정합니다.
Public 속성Controls TagPrefixInfo 개체의 컬렉션을 가져옵니다.
Public 속성CurrentConfiguration현재 ConfigurationElement 인스턴스가 속해 있는 구성 계층 구조를 나타내는 최상위 Configuration 인스턴스에 대한 참조를 가져옵니다. (ConfigurationElement에서 상속됨)
Public 속성ElementInformation ConfigurationElement 개체의 사용자 지정할 수 없는 정보와 기능을 포함하는 ElementInformation 개체를 가져옵니다. (ConfigurationElement에서 상속됨)
Protected 속성ElementProperty ConfigurationElement 개체 자체를 나타내는 ConfigurationElementProperty 개체를 가져옵니다. (ConfigurationElement에서 상속됨)
Public 속성EnableEventValidation이벤트 유효성 검사의 활성화 여부를 지정하는 값을 가져오거나 설정합니다.
Public 속성EnableSessionState세션 상태가 활성화되었는지 여부 또는 읽기 전용인지 지정하는 값을 가져오거나 설정합니다.
Public 속성EnableViewState뷰 상태가 활성화되었는지 여부를 나타내는 값을 가져오거나 설정합니다.
Public 속성EnableViewStateMac클라이언트에서 페이지를 다시 게시할 때 ASP.NET에서 페이지의 뷰 상태에 대해 MAC(메시지 인증 코드)를 실행해야 하는지 여부를 지정하는 값을 가져오거나 설정합니다.
Public 속성IgnoreDeviceFilters페이지를 렌더링할 때 ASP.NET이 무시해야 하는 장치 태그의 컬렉션을 가져옵니다.
Protected 속성Item[ConfigurationProperty]이 구성 요소의 속성이나 특성을 가져오거나 설정합니다. (ConfigurationElement에서 상속됨)
Protected 속성Item[String]이 구성 요소의 속성, 특성 또는 자식 요소를 가져오거나 설정합니다. (ConfigurationElement에서 상속됨)
Public 속성LockAllAttributesExcept잠긴 특성의 컬렉션을 가져옵니다. (ConfigurationElement에서 상속됨)
Public 속성LockAllElementsExcept잠긴 요소의 컬렉션을 가져옵니다. (ConfigurationElement에서 상속됨)
Public 속성LockAttributes잠긴 특성의 컬렉션을 가져옵니다. (ConfigurationElement에서 상속됨)
Public 속성LockElements잠긴 요소의 컬렉션을 가져옵니다. (ConfigurationElement에서 상속됨)
Public 속성LockItem요소가 잠겨 있는지 여부를 나타내는 값을 가져오거나 설정합니다. (ConfigurationElement에서 상속됨)
Public 속성MaintainScrollPositionOnPostBack서버에서 다시 게시한 후 페이지 스크롤 위치를 유지할지 여부를 나타내는 값을 가져오거나 설정합니다.
Public 속성MasterPageFile응용 프로그램의 마스터 페이지에 대한 참조를 가져오거나 설정합니다.
Public 속성MaxPageStateFieldLength뷰 상태 필드 하나에 포함될 수 있는 최대 문자 수를 가져오거나 설정합니다.
Public 속성Namespaces NamespaceInfo 개체의 컬렉션을 가져옵니다.
Public 속성PageBaseType.aspx 페이지에 기본적으로 상속되는 코드 숨김 클래스를 지정하는 값을 가져오거나 설정합니다.
Public 속성PageParserFilterType파서 필터 형식을 지정하는 값을 가져오거나 설정합니다.
Protected 속성Properties속성 컬렉션을 가져옵니다. (ConfigurationElement에서 상속됨)
Public 속성RenderAllHiddenFieldsAtTopOfForm모든 시스템 생성 숨김 필드가 폼 시작 부분에서 렌더링되는지 여부를 나타내는 값을 가져오거나 설정합니다.
Public 속성SectionInformation사용자가 지정할 수 없는 ConfigurationSection 개체의 정보와 기능을 포함하는 SectionInformation 개체를 가져옵니다. (ConfigurationSection에서 상속됨)
Public 속성SmartNavigation스마트 탐색의 사용 여부를 나타내는 값을 가져오거나 설정합니다.
Public 속성StyleSheetThemeASP.NET 스타일시트 테마의 이름을 가져오거나 설정합니다.
Public 속성TagMapping TagMapInfo 개체의 컬렉션을 가져옵니다.
Public 속성ThemeASP.NET 페이지 테마의 이름을 가져오거나 설정합니다.
Public 속성UserControlBaseType사용자 정의 컨트롤에 기본적으로 상속되는 코드 숨김 클래스를 지정하는 값을 가져오거나 설정합니다.
Public 속성ValidateRequestASP.NET에서 브라우저의 입력 값에 대해 위험성을 검사할지 여부를 결정하는 값을 가져오거나 설정합니다. 자세한 내용은 Script Exploits Overview를 참조하십시오.
Public 속성ViewStateEncryptionMode ViewState 값을 유지하는 데 사용되는 암호화 모드를 가져오거나 설정합니다.
위쪽
  이름설명
Protected 메서드DeserializeElement구성 파일에서 XML을 읽습니다. (ConfigurationElement에서 상속됨)
Protected 메서드DeserializeSection인프라입니다. 구성 파일에서 XML을 읽습니다. (ConfigurationSection에서 상속됨)
Public 메서드Equals현재 ConfigurationElement 인스턴스를 지정된 개체와 비교합니다. (ConfigurationElement에서 상속됨)
Public 메서드GetHashCode현재 ConfigurationElement 인스턴스를 나타내는 고유 값을 가져옵니다. (ConfigurationElement에서 상속됨)
Protected 메서드GetRuntimeObject파생 클래스에서 재정의될 때 사용자 지정 개체를 반환합니다. (ConfigurationSection에서 상속됨)
Public 메서드GetType현재 인스턴스의 Type을 가져옵니다. (Object에서 상속됨)
Protected 메서드Init ConfigurationElement 개체를 초기 상태로 설정합니다. (ConfigurationElement에서 상속됨)
Protected 메서드InitializeDefault ConfigurationElement 개체 값의 기본 집합을 초기화하는 데 사용됩니다. (ConfigurationElement에서 상속됨)
Protected 메서드IsModified이 구성 요소가 파생 클래스에서 구현되었을 때 마지막으로 저장되거나 로드된 이후 수정되었는지 여부를 나타냅니다. (ConfigurationSection에서 상속됨)
Public 메서드IsReadOnly ConfigurationElement 개체가 읽기 전용인지 여부를 나타내는 값을 가져옵니다. (ConfigurationElement에서 상속됨)
Protected 메서드Reset잠금 및 속성 컬렉션을 비롯하여 ConfigurationElement 개체의 내부 상태를 다시 설정합니다. (ConfigurationElement에서 상속됨)
Protected 메서드ResetModified파생 클래스에서 구현될 때 IsModified 메서드의 값을 false로 다시 설정합니다. (ConfigurationSection에서 상속됨)
Protected 메서드SerializeElement파생 클래스에서 구현될 때 구성 요소의 내용을 구성 파일에 씁니다. (ConfigurationElement에서 상속됨)
Protected 메서드SerializeSection인프라입니다. ConfigurationSection 개체의 병합되지 않은 뷰가 들어 있는 XML 문자열을 파일에 쓸 단일 섹션으로 만듭니다. (ConfigurationSection에서 상속됨)
Protected 메서드SerializeToXmlElement파생 클래스에서 구현될 때 구성 요소의 외부 태그를 구성 파일에 씁니다. (ConfigurationElement에서 상속됨)
Protected 메서드SetReadOnly ConfigurationElement 개체와 모든 하위 요소에 대한 IsReadOnly 속성을 설정합니다. (ConfigurationElement에서 상속됨)
Protected 메서드ShouldSerializeElementInTargetVersion지정된 대상 버전의 .NET Framework에 대해 구성 개체 계층 구조가 serialize된 경우 지정된 요소를 serialize할지 여부를 나타냅니다. (ConfigurationSection에서 상속됨)
Protected 메서드ShouldSerializePropertyInTargetVersion지정된 대상 버전의 .NET Framework에 대해 구성 개체 계층 구조가 serialize된 경우 지정된 속성을 serialize할지 여부를 나타냅니다. (ConfigurationSection에서 상속됨)
Protected 메서드ShouldSerializeSectionInTargetVersion지정된 대상 버전의 .NET Framework에 대해 구성 개체 계층 구조가 serialize된 경우 현재 ConfigurationSection 인스턴스를 serialize할지 여부를 나타냅니다. (ConfigurationSection에서 상속됨)
Public 메서드ToString현재 개체를 나타내는 문자열을 반환합니다. (Object에서 상속됨)
Protected 메서드Unmerge ConfigurationElement 개체를 수정하여 저장되지 않아야 하는 값을 모두 제거합니다. (ConfigurationElement에서 상속됨)
위쪽

PagesSection 클래스를 사용하면 구성 파일의 페이지 섹션에 있는 내용을 프로그래밍 방식으로 액세스하고 수정할 수 있습니다. 이 구성 섹션에서는 구성 파일의 범위 내에 있는 모든 페이지와 컨트롤에 대해 특정 ASP.NET 페이지 및 컨트롤 지시문을 전역으로 설정할 수 있습니다. 예를 들어 @ Page 지시문, Namespaces 컬렉션 속성을 사용한 @ Import 지시문 및 Controls 컬렉션 속성을 사용한 @ Register 지시문을 설정할 수 있습니다. 또한 이 섹션에서는 TagMapping 컬렉션 속성을 사용하여 런타임에 태그 형식을 다른 태그 형식에 매핑할 수도 있습니다.

지시문은 페이지와 사용자 정의 컨트롤 컴파일러에서 ASP.NET Web Forms 페이지(.aspx) 및 사용자 정의 컨트롤 파일(.ascx)을 처리할 때 사용되는 설정을 지정합니다.

이 예제에서는 PagesSection 클래스의 멤버로 액세스할 수도 있는 pages 섹션의 몇 가지 특성에 대한 값을 선언적으로 지정하는 방법을 보여 줍니다.

다음 구성 파일 예제에서는 페이지 섹션의 값을 선언적으로 지정하는 방법을 보여 줍니다.

<system.web>
  <pages buffer="true" 
    enableSessionState="true" 
    enableViewState="true"
    enableViewStateMac="true" 
    autoEventWireup="true" 
    validateRequest="true"
    asyncTimeout="45"
    maintainScrollPositionOnPostBack = "False"
    viewStateEncryptionMode = "Auto">
    <namespaces>
      <add namespace="System" />
      <add namespace="System.Collections" />
      <add namespace="System.Collections.Specialized" />
      <add namespace="System.ComponentModel" />
      <add namespace="System.Configuration" />
      <add namespace="System.Web" />
    </namespaces>
    <controls>
      <clear />
      <remove tagPrefix="MyTags" />
      <!—- Searches all linked assemblies for the namespace -->
      <add tagPrefix="MyTags1" namespace=" MyNameSpace "/>
      <!-- Uses a specified assembly -->
      <add tagPrefix="MyTags2" namespace="MyNameSpace" 
        assembly="MyAssembly"/>
      <!-- Uses the specified source for the user control -->
      <add tagprefix="MyTags3" tagname="MyCtrl"     
        src="MyControl.ascx"/>
    </controls>
    <tagMapping>
      <clear />
      <add
        tagTypeName=
          "System.Web.UI.WebControls.WebParts.WebPartManager"
        mappedTagTypeName=
          "Microsoft.Sharepoint.WebPartPartManager, 
          MSPS.Web.dll, Version='2.0.0.0'" 
      />
      <remove tagTypeName="SomeOtherNS.Class, Assemblyname" />
    </tagMapping>
  </pages>
</system.web>

다음 코드 예제에서는 PagesSection 클래스를 사용하는 방법을 보여 줍니다.


using System;
using System.Collections;
using System.Collections.Specialized;
using System.Configuration;
using System.Web.Configuration;
using System.Web.UI;


namespace Samples.Aspnet.SystemWebConfiguration
{
  class UsingPagesSection
  {
    public static void Main()
    {
      try
      {
        // Get the Web application configuration.
        Configuration configuration =
          WebConfigurationManager.OpenWebConfiguration("");

        // Get the section.
        PagesSection pagesSection =
            (PagesSection)configuration.GetSection("system.web/pages");

        // Get the AutoImportVBNamespace property.
        Console.WriteLine("AutoImportVBNamespace: '{0}'",
            pagesSection.Namespaces.AutoImportVBNamespace.ToString());

        // Set the AutoImportVBNamespace property.
        pagesSection.Namespaces.AutoImportVBNamespace = true;

        // Get all current Namespaces in the collection.
        for (int i = 0; i < pagesSection.Namespaces.Count; i++)
        {
          Console.WriteLine(
              "Namespaces {0}: '{1}'", i,
              pagesSection.Namespaces[i].Namespace);
        }

        // Create a new NamespaceInfo object.
        System.Web.Configuration.NamespaceInfo namespaceInfo =
            new System.Web.Configuration.NamespaceInfo("System");

        // Set the Namespace property.
        namespaceInfo.Namespace = "System.Collections";

        // Execute the Add Method.
        pagesSection.Namespaces.Add(namespaceInfo);

        // Add a NamespaceInfo object using a constructor.
        pagesSection.Namespaces.Add(
            new System.Web.Configuration.NamespaceInfo(
            "System.Collections.Specialized"));

        // Execute the RemoveAt method.
        pagesSection.Namespaces.RemoveAt(0);

        // Execute the Clear method.
        pagesSection.Namespaces.Clear();

        // Execute the Remove method.
        pagesSection.Namespaces.Remove("System.Collections");

        // Get the current AutoImportVBNamespace property value.
        Console.WriteLine(
            "Current AutoImportVBNamespace value: '{0}'",
            pagesSection.Namespaces.AutoImportVBNamespace);

        // Set the AutoImportVBNamespace property to false.
        pagesSection.Namespaces.AutoImportVBNamespace = false;

        // Get the current PageParserFilterType property value.
        Console.WriteLine(
            "Current PageParserFilterType value: '{0}'",
            pagesSection.PageParserFilterType);

        // Set the PageParserFilterType property to
        // "MyNameSpace.AllowOnlySafeControls".
        pagesSection.PageParserFilterType =
            "MyNameSpace.AllowOnlySafeControls";

        // Get the current Theme property value.
        Console.WriteLine(
            "Current Theme value: '{0}'",
            pagesSection.Theme);

        // Set the Theme property to "MyCustomTheme".
        pagesSection.Theme = "MyCustomTheme";

        // Get the current EnableViewState property value.
        Console.WriteLine(
            "Current EnableViewState value: '{0}'",
            pagesSection.EnableViewState);

        // Set the EnableViewState property to false.
        pagesSection.EnableViewState = false;

        // Get the current CompilationMode property value.
        Console.WriteLine(
            "Current CompilationMode value: '{0}'",
            pagesSection.CompilationMode);

        // Set the CompilationMode property to CompilationMode.Always.
        pagesSection.CompilationMode = CompilationMode.Always;

        // Get the current ValidateRequest property value.
        Console.WriteLine(
            "Current ValidateRequest value: '{0}'",
            pagesSection.ValidateRequest);

        // Set the ValidateRequest property to true.
        pagesSection.ValidateRequest = true;

        // Get the current EnableViewStateMac property value.
        Console.WriteLine(
            "Current EnableViewStateMac value: '{0}'",
            pagesSection.EnableViewStateMac);

        // Set the EnableViewStateMac property to true.
        pagesSection.EnableViewStateMac = true;

        // Get the current AutoEventWireup property value.
        Console.WriteLine(
            "Current AutoEventWireup value: '{0}'",
            pagesSection.AutoEventWireup);

        // Set the AutoEventWireup property to false.
        pagesSection.AutoEventWireup = false;

        // Get the current MaxPageStateFieldLength property value.
        Console.WriteLine(
            "Current MaxPageStateFieldLength value: '{0}'",
            pagesSection.MaxPageStateFieldLength);

        // Set the MaxPageStateFieldLength property to 4098.
        pagesSection.MaxPageStateFieldLength = 4098;

        // Get the current UserControlBaseType property value.
        Console.WriteLine(
            "Current UserControlBaseType value: '{0}'",
            pagesSection.UserControlBaseType);

        // Set the UserControlBaseType property to
        // "MyNameSpace.MyCustomControlBaseType".
        pagesSection.UserControlBaseType =
            "MyNameSpace.MyCustomControlBaseType";

        // Get all current Controls in the collection.
        for (int i = 0; i < pagesSection.Controls.Count; i++)
        {
          Console.WriteLine("Control {0}:", i);
          Console.WriteLine("  TagPrefix = '{0}' ",
              pagesSection.Controls[i].TagPrefix);
          Console.WriteLine("  TagName = '{0}' ",
              pagesSection.Controls[i].TagName);
          Console.WriteLine("  Source = '{0}' ",
              pagesSection.Controls[i].Source);
          Console.WriteLine("  Namespace = '{0}' ",
              pagesSection.Controls[i].Namespace);
          Console.WriteLine("  Assembly = '{0}' ",
              pagesSection.Controls[i].Assembly);
        }

        // Create a new TagPrefixInfo object.
        System.Web.Configuration.TagPrefixInfo tagPrefixInfo =
            new System.Web.Configuration.TagPrefixInfo("MyCtrl", "MyNameSpace", "MyAssembly", "MyControl", "MyControl.ascx");

        // Execute the Add Method.
        pagesSection.Controls.Add(tagPrefixInfo);

        // Add a TagPrefixInfo object using a constructor.
        pagesSection.Controls.Add(
            new System.Web.Configuration.TagPrefixInfo(
            "MyCtrl", "MyNameSpace", "MyAssembly", "MyControl",
            "MyControl.ascx"));

        // Get the current StyleSheetTheme property value.
        Console.WriteLine(
            "Current StyleSheetTheme value: '{0}'",
            pagesSection.StyleSheetTheme);

        // Set the StyleSheetTheme property.
        pagesSection.StyleSheetTheme =
            "MyCustomStyleSheetTheme";

        // Get the current EnableSessionState property value.
        Console.WriteLine(
            "Current EnableSessionState value: '{0}'",
            pagesSection.EnableSessionState);

        // Set the EnableSessionState property to
        // PagesEnableSessionState.ReadOnly.
        pagesSection.EnableSessionState =
            PagesEnableSessionState.ReadOnly;

        // Get the current MasterPageFile property value.
        Console.WriteLine(
            "Current MasterPageFile value: '{0}'",
            pagesSection.MasterPageFile);

        // Set the MasterPageFile property to "MyMasterPage.ascx".
        pagesSection.MasterPageFile = "MyMasterPage.ascx";

        // Get the current Buffer property value.
        Console.WriteLine(
            "Current Buffer value: '{0}'", pagesSection.Buffer);

        // Set the Buffer property to true.
        pagesSection.Buffer = true;

        // Get all current TagMappings in the collection.
        for (int i = 0; i < pagesSection.TagMapping.Count; i++)
        {
          Console.WriteLine("TagMapping {0}:", i);
          Console.WriteLine("  TagTypeName = '{0}'",
              pagesSection.TagMapping[i].TagType);
          Console.WriteLine("  MappedTagTypeName = '{0}'",
              pagesSection.TagMapping[i].MappedTagType);
        }

        // Add a TagMapInfo object using a constructor.
        pagesSection.TagMapping.Add(
            new System.Web.Configuration.TagMapInfo(
            "MyNameSpace.MyControl", "MyNameSpace.MyOtherControl"));

        // Get the current PageBaseType property value.
        Console.WriteLine(
            "Current PageBaseType value: '{0}'",
            pagesSection.PageBaseType);

        // Set the PageBaseType property to
        // "MyNameSpace.MyCustomPagelBaseType".
        pagesSection.PageBaseType =
            "MyNameSpace.MyCustomPagelBaseType";

        // Get the current SmartNavigation property value.
        Console.WriteLine(
            "Current SmartNavigation value: '{0}'",
            pagesSection.SmartNavigation);

        // Set the SmartNavigation property to true.
        pagesSection.SmartNavigation = true;

        // Update if not locked.
        if (!pagesSection.SectionInformation.IsLocked)
        {
          configuration.Save();
          Console.WriteLine("** Configuration updated.");
        }
        else
          Console.WriteLine("** Could not update, section is locked.");
      }
      catch (System.Exception e)
      {
        // Unknown error.
        Console.WriteLine("A unknown exception detected in" +
          "UsingPagesSection Main.");
        Console.WriteLine(e);
      }
      Console.ReadLine();
    }
  } // UsingPagesSection class end.
} // Samples.Aspnet.SystemWebConfiguration namespace end.


.NET Framework

4.5, 4, 3.5, 3.0, 2.0에서 지원

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008(서버 코어 역할은 지원되지 않음), Windows Server 2008 R2(서버 코어 역할은 SP1 이상에서 지원, Itanium은 지원되지 않음)

.NET Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.
이 형식의 모든 공용 static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.
이 정보가 도움이 되었습니까?
(1500자 남음)

커뮤니티 추가 항목

추가
Microsoft는 MSDN 웹 사이트에 대한 귀하의 의견을 이해하기 위해 온라인 설문 조사를 진행하고 있습니다. 참여하도록 선택하시면 MSDN 웹 사이트에서 나가실 때 온라인 설문 조사가 표시됩니다.

참여하시겠습니까?
© 2013 Microsoft. All rights reserved.