PagesSection Class
Assembly: System.Web (in system.web.dll)
The PagesSection class provides a way to programmatically access and modify the content of the configuration file pages Element (ASP.NET Settings Schema) 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 (<%@ Page %>), the Import directive (<%@ Import %>) through the Namespaces collection property, and the Register directive (<%@ Register %>) 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 Element (ASP.NET Settings Schema) 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.
System.Configuration.ConfigurationElement
System.Configuration.ConfigurationSection
System.Web.Configuration.PagesSection