PagesSection Class
Provides programmatic access to the pages section of the configuration file. This class cannot be inherited.
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 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.
System.Configuration.ConfigurationElement
System.Configuration.ConfigurationSection
System.Web.Configuration.PagesSection
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.