This page is likely outdated (last edited on 25 Jun 2008). Visit the new documentation for updated content.

Config system.web pages

The <pages> directive appears inside the <system.web> section of Web.config.

ASP.NET pages are a generating by mixing the contents of an .asmx file with code generated by the ASP.NET runtime. The <pages> section is used to control some aspects of the page compilation process.

It has the following generic format

<pages
    asyncTimeout="timespan"
    autoEventWireup="boolean"
    buffer="boolean"
    enableEventValidation="boolean"
    enableSessionState="enumeration"
    enableViewState="boolean"
    enableViewStateMac="boolean"
    maintainScrollPositionOnPostBack="boolean"
    masterPageFile="name"
    maxPageStateFieldLength="number"
    compilationMode="enum"
    namespaces="enum"
    pageBaseType="string"
    pageParserFilterType="typename"
    smartNavigation="boolean"
    styleSheetTheme="string"
    theme="string"
    userControlBaseType="typename"
    validateRequest="boolean"
    viewStateEncryptionMode="enum"
>
   <tagMapping>...</tagMapping>
</pages>

Table of contents

asyncTimeout

Default value: 00:00:45

The timeout used for async handlers before the operation is timed out.

enableSessionState

Whether session state is required by the page.

Posible values: true, false, ReadOnly.

Default value: true

autoEventWireup

Controls whether automatic event wiring up happens for this particular page. This value can be set on the machine.config and Web.config’s <pages> section using this syntax (and in individual aspx files, and web user controls (ascx) by using settig it on the @Page attribute).

When autoEventWireup is set to false, for events to be invoked, the developer must manually add those events to his code, like this:

   // Hook up the "Page_Load" method to the "Load" event.
   this.Load += new EventHandler (Page_Load);

When creating pages with Visual Studio, the default event wireup is set to false. And Visual Studio generates static code that invokes the various events (like Page_Load) for you.

When autoEventWireup is set to true the runtime will bind the methods that follow the name pattern Page_EVENTNAME to the event EVENTNAME. This introduces a bit of a startup problem, as the runtime must first find all the methods and bind them.

For more details see AutoEventWireup attribute in Microsoft ASP.NET Web Forms article in the CodeProject.

Posible values: true, false.

Default value: true.

pageBaseType

This controls the base type for the pages. The default value is the System.Web.UI.Page, but you can replace it here.

Default value: System.Web.UI.Page

userControlBaseType

This controls the base type for user controls. The default value is the System.Web.UI.UserControl value.

Default value: System.Web.UI.UserControl

<tagMapping>

<tagMapping> 
   <add /> 
   <remove /> 
   <clear/>
</tagMapping>

It is used to define tag type mapping for all the pages within the current application which are affected by the given Web.config file (that is, the directory where the Web.config file is found and all the subdirectories, unless one of the subdirectories has a Web.config file which clears/removes/changes the tag mappings). Support for this appeared in the Mono 1.2.3 release and is only available for ASP.NET 2.0 applications.

The <add> element syntax:

<add tagType="[source tag type]" mappedTagType="[target tag type]"/>

Both attributes are required.

The <remove> element syntax:

<remove tagType="[tag type to remove]"/>

The attribute is required.

A usage example:

<pages>
  <tagMapping>
     <clear/>
     <add tagType="System.Web.UI.WebControls.Login"
          mappedTagType="NewLogin, TestLibrary" />
  </tagMapping>
</pages>