Export (0) Print
Expand All

PagesSection Class

Provides programmatic access to the pages section of the configuration file. This class cannot be inherited.

Namespace:  System.Web.Configuration
Assembly:  System.Web (in System.Web.dll)

public ref class PagesSection sealed : public ConfigurationSection

The PagesSection type exposes the following members.

  NameDescription
Public methodPagesSectionInfrastructure. Initializes a new instance of the PagesSection class using default settings.
Top

  NameDescription
Public propertyAsyncTimeoutGets or sets a value indicating the number of seconds to wait for an asynchronous handler to complete during asynchronous page processing.
Public propertyAutoEventWireupGets or sets a value indicating whether events for ASP.NET pages are automatically connected to event-handling functions.
Public propertyBufferGets or sets a value that specifies whether .aspx pages and .ascx controls use response buffering.
Public propertyClientIDModeGets or sets the default algorithm that is used to generate a control's identifier.
Public propertyCompilationModeGets or sets a value that determines how .aspx pages and .ascx controls are compiled.
Public propertyControlRenderingCompatibilityVersionGets or sets a value that specifies the ASP.NET version that any rendered HTML will be compatible with.
Public propertyControlsGets a collection of TagPrefixInfo objects.
Public propertyCurrentConfigurationGets a reference to the top-level Configuration instance that represents the configuration hierarchy that the current ConfigurationElement instance belongs to. (Inherited from ConfigurationElement.)
Public propertyElementInformationGets an ElementInformation object that contains the non-customizable information and functionality of the ConfigurationElement object. (Inherited from ConfigurationElement.)
Protected propertyElementPropertyGets the ConfigurationElementProperty object that represents the ConfigurationElement object itself. (Inherited from ConfigurationElement.)
Public propertyEnableEventValidationGets or sets a value that specifies whether event validation is enabled.
Public propertyEnableSessionStateGets or sets a value that specifies whether the session state is enabled, disabled, or read-only.
Public propertyEnableViewStateGets or sets a value indicating whether view state is enabled or disabled.
Public propertyEnableViewStateMacGets or sets a value that specifies whether ASP.NET should run a message authentication code (MAC) on the page's view state when the page is posted back from the client.
Public propertyIgnoreDeviceFiltersGets the collection of device tags that ASP.NET should ignore when it renders a page.
Protected propertyItem[ConfigurationProperty]Gets or sets a property or attribute of this configuration element. (Inherited from ConfigurationElement.)
Protected propertyItem[String]Gets or sets a property, attribute, or child element of this configuration element. (Inherited from ConfigurationElement.)
Public propertyLockAllAttributesExceptGets the collection of locked attributes. (Inherited from ConfigurationElement.)
Public propertyLockAllElementsExceptGets the collection of locked elements. (Inherited from ConfigurationElement.)
Public propertyLockAttributesGets the collection of locked attributes (Inherited from ConfigurationElement.)
Public propertyLockElementsGets the collection of locked elements. (Inherited from ConfigurationElement.)
Public propertyLockItemGets or sets a value indicating whether the element is locked. (Inherited from ConfigurationElement.)
Public propertyMaintainScrollPositionOnPostBackGets or sets a value indicating whether the page scroll position should be maintained upon returning from a postback from the server.
Public propertyMasterPageFileGets or sets a reference to the master page for the application.
Public propertyMaxPageStateFieldLengthGets or sets the maximum number of characters that a single view-state field can contain.
Public propertyNamespacesGets a collection of NamespaceInfo objects.
Public propertyPageBaseTypeGets or sets a value that specifies a code-behind class that .aspx pages inherit by default.
Public propertyPageParserFilterTypeGets or sets a value that specifies the parser filter type.
Protected propertyPropertiesGets the collection of properties. (Inherited from ConfigurationElement.)
Public propertyRenderAllHiddenFieldsAtTopOfFormGets or sets a value that indicates whether all system-generated hidden fields are rendered at the top of the form.
Public propertySectionInformationGets a SectionInformation object that contains the non-customizable information and functionality of the ConfigurationSection object. (Inherited from ConfigurationSection.)
Public propertySmartNavigationGets or sets a value that indicates whether smart navigation is enabled.
Public propertyStyleSheetThemeGets or sets the name of an ASP.NET style sheet theme.
Public propertyTagMappingGets a collection of TagMapInfo objects.
Public propertyThemeGets or sets the name of an ASP.NET page theme.
Public propertyUserControlBaseTypeGets or sets a value that specifies a code-behind class that user controls inherit by default.
Public propertyValidateRequestGets or sets a value that determines whether ASP.NET examines input from the browser for dangerous values. For more information, see Script Exploits Overview.
Public propertyViewStateEncryptionModeGets or sets the encryption mode that ASP.NET uses when maintaining ViewState values.
Top

  NameDescription
Protected methodDeserializeElementReads XML from the configuration file. (Inherited from ConfigurationElement.)
Protected methodDeserializeSectionInfrastructure. Reads XML from the configuration file. (Inherited from ConfigurationSection.)
Public methodEqualsCompares the current ConfigurationElement instance to the specified object. (Inherited from ConfigurationElement.)
Public methodGetHashCodeGets a unique value representing the current ConfigurationElement instance. (Inherited from ConfigurationElement.)
Protected methodGetRuntimeObjectReturns a custom object when overridden in a derived class. (Inherited from ConfigurationSection.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodInitSets the ConfigurationElement object to its initial state. (Inherited from ConfigurationElement.)
Protected methodInitializeDefaultUsed to initialize a default set of values for the ConfigurationElement object. (Inherited from ConfigurationElement.)
Protected methodIsModifiedIndicates whether this configuration element has been modified since it was last saved or loaded when implemented in a derived class. (Inherited from ConfigurationSection.)
Public methodIsReadOnlyGets a value indicating whether the ConfigurationElement object is read-only. (Inherited from ConfigurationElement.)
Protected methodResetResets the internal state of the ConfigurationElement object, including the locks and the properties collections. (Inherited from ConfigurationElement.)
Protected methodResetModifiedResets the value of the IsModified method to false when implemented in a derived class. (Inherited from ConfigurationSection.)
Protected methodSerializeElementWrites the contents of this configuration element to the configuration file when implemented in a derived class. (Inherited from ConfigurationElement.)
Protected methodSerializeSectionInfrastructure. Creates an XML string containing an unmerged view of the ConfigurationSection object as a single section to write to a file. (Inherited from ConfigurationSection.)
Protected methodSerializeToXmlElementWrites the outer tags of this configuration element to the configuration file when implemented in a derived class. (Inherited from ConfigurationElement.)
Protected methodSetReadOnlySets the IsReadOnly property for the ConfigurationElement object and all subelements. (Inherited from ConfigurationElement.)
Protected methodShouldSerializeElementInTargetVersionIndicates whether the specified element should be serialized when the configuration object hierarchy is serialized for the specified target version of the .NET Framework. (Inherited from ConfigurationSection.)
Protected methodShouldSerializePropertyInTargetVersionIndicates whether the specified property should be serialized when the configuration object hierarchy is serialized for the specified target version of the .NET Framework. (Inherited from ConfigurationSection.)
Protected methodShouldSerializeSectionInTargetVersionIndicates whether the current ConfigurationSection instance should be serialized when the configuration object hierarchy is serialized for the specified target version of the .NET Framework. (Inherited from ConfigurationSection.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Protected methodUnmergeModifies the ConfigurationElement object to remove all values that should not be saved. (Inherited from ConfigurationElement.)
Top

The PagesSection class provides a way to programmatically access and modify the content of the configuration file pages section. This configuration section supports setting certain ASP.NET page and control directives globally for all pages and controls in the scope of the configuration file. This includes the @ Page directive, the @ Import directive through the Namespaces collection property, and the @ Register directive through the Controls collection property. It also provides support for mapping tag types to other tag types at run time through the TagMapping collection property.

Directives specify settings used by the page and user-control compilers when they process ASP.NET Web Forms page (.aspx) and user control (.ascx) files.

This example demonstrates how to specify values declaratively for several attributes of the pages section, which can also be accessed as members of the PagesSection class.

The following configuration file example shows how to specify values declaratively for the pages section.

<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>

The following code example demonstrates how to use the PagesSection class.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft