asp.net.ph

Skip Navigation Links

<pages> Section

ASP.NET Syntax   ASP.NET Configuration Sections


Defines page-specific configuration settings that are applied within the scope of the configuration file. The <pages> section can be declared at the machine, site, application, and subdirectory levels.

<pages
   asyncTimeout = "number"
   autoEventWireup = "true | false"
   buffer = "true | false"
   compilationMode = "Always | Auto | Never"
   enableSessionState = "true | false | ReadOnly"
   enableViewState = "true | false"
   enableViewStateMac = "true | false"
   maintainScrollPositionOnPostBack = "true | false"
   masterPageFile = "file path"
   maxPageStateFieldLength = "number"
   pageBaseType = "typename, assembly"
   pageParserFilterType = "string"
   smartNavigation = "true | false"
   styleSheetTheme = "string"
   theme = "string"
   userControlBaseType = "typename"
   validateRequest = "true | false"
   viewStateEncryptionMode = "Always | Auto | Never"
>
   <controls>...</controls>
   <namespaces>...</namespaces>
   <tagMapping>...</tagMapping>
</pages>

Attributes

The <pages> tag supports the following attributes.

Attribute Description
asyncTimeout Optional TimeSpan attribute that specifies the number of seconds to wait for an asynchronous handler to complete during asynchronous processing.

This attribute is new in the .NET Framework version 2.0.

The default is "0:00:45" ( 45 seconds ).

autoEventWireup Optional Boolean attribute that specifies whether page events are automatically enabled. This is if the autoevent wire up occurs, which means that the system will automatically attach the methods of a particular signature ( page_Load for example ). For more information, see Web Forms Event Model.

The default is true.

buffer Optional Boolean attribute that specifies whether the URL resource uses response buffering.

The default is true.

compilationMode Optional CompilationMode attribute.

Specifies whether an ASP.NET page or control should be compiled at run time.

The compilationMode attribute is new in the .NET Framework version 2.0. This attribute can be one of the following possible values. The default is Always.

Value Description
Always The page should always be compiled.
Auto ASP.NET will not compile the page, if possible.
Never The page or control should never be dynamically compiled.

If a page contains a script block or code construct that requires compilation, ASP.NET will return with an error and the page will not run.

enableSessionState Optional String attribute that specifies session state requirements for the resources that are within the scope of the configuration file.

The enableSessionState attribute can be one of the following possible values. The default is true.

Value Description
False Indicates that session state is disabled.
ReadOnly Indicates that session state is not writable.
true Indicates that session state is enabled.
enableViewState Optional Boolean attribute that specifies whether view state is enabled and maintained across page requests.

The default is true.

enableViewStateMac Optional Boolean attribute that specifies whether ASP.NET should run a message authentication code ( MAC ) on the view state for the page when the page is posted back from the client. If true, the encrypted view state is checked to verify that it has not been tampered with on the client.

The default is true.

maintainScrollPositionOnPostBack Optional Boolean attribute that specifies whether to return the user to the same position in the client browser when pages are posted back to the server. If False, the user is returned to the top of the page on a post back.

This attribute is new in the .NET Framework version 2.0.

The default is false.

masterPageFile Optional String attribute that specifies the master page path relative to the local configuration file. Pages that have the masterPageFile attribute set to true must contain a Content control as the top level control

This attribute is new in the .NET Framework version 2.0.

The default is an empty string ( "" ).

maxPageStateFieldLength Optional Int32 attribute that specifies the maximum length in characters for the state field for the page. If set to a positive number, the view-state field that is sent to the client browser is separated into chunks, and each chunk is less than the size that is specified in the maxPageStateFieldLength attribute. If set to a negative number, the view-state field should not be separated into chunks.

This attribute is new in the .NET Framework version 2.0.

The default is "-1".

pageBaseType Optional String attribute that specifies the base to use when the pages are stand-alone only. This is overriden by the inherits attribute in a stand-alone file.

The default is "System.Web.UI.Page".

pageParserFilterType

 

Optional String attribute that specifies the type name of a filter that is used by the ASP.NET parser to determine whether an item is allowed in the page at parse time. The filter must derive from the PageParserFilter class.

This attribute is new in the .NET Framework version 2.0.

The default is an empty string ( "" ).

smartNavigation Optional Boolean attribute that specifies whether smart navigation is enabled. Smart navigation requires Microsoft Internet Explorer version 5.5 or later. When smart navigation is enabled, the user experiences the following benefits:
  • Navigational flashing is eliminated.
  • Scroll position is persisted between pages.
  • Element focus is persisted between pages.
  • The last state for the page is the only state retained by the history on the browser.

This attribute is new in the .NET Framework version 2.0, but has been deprecated in favor of the maintainScrollPositionOnPostBack attribute.

The default is false.

styleSheetTheme Optional String attribute that specifies the name of the "named theme" folder to be used to apply the theme before control declarations, in contrast with the theme attribute which defines the theme to apply after the control declaration.

This attribute is new in the .NET Framework version 2.0.

The default is an empty string ( "" ).

theme Optional String attribute that specifies the name of the theme that is used for the pages that are within the scope of the configuration file. The specified theme must exist as either an application or a global theme. If the theme does not exist, an HttpException exception is thrown.

This attribute is new in the .NET Framework version 2.0.

The default is an empty string ( "" ).

userControlBaseType Optional String attribute that specifies the base to use when the pages are stand-alone only.

The default is "System.Web.UI.UserControl".

validateRequest Optional Boolean attribute which indicates that ASP.NET examines all input from the browser for potentially dangerous data. If true, request validation is performed by comparing all input data to a list of potentially dangerous values. If a match occurs, ASP.NET raises an HttpRequestValidationException exception.

The default is true.

viewStateEncryptionMode Optional ViewStateEncryptionMode attribute that specifies the encryption mode of the view state. The ViewStateEncryptionMode property overrides this attribute that is set in the configuration file.

This attribute can be one of the following possible values.

Value Description
Always View state is always encrypted.
Auto View state is encrypted, if a control requests it.
Never View state is never encrypted, even if a control requests it.

This attribute is new in the .NET Framework version 2.0.

The default is Auto.


Child Elements

The <pages> tag supports the following child elements.

Element Description
controls Defines a collection of register directives and the namespaces where the tag prefixes reside.
namespaces Defines a collection of import directives to use during assembly pre-compilation.
tagMapping Defines a collection of tag types that are remapped to other tag types at compile time.

Parent Elements

The <pages> tag supports the following parent elements.

Element Description
configuration The required root element in every configuration file that is used by the common language runtime and the .NET Framework–based applications.
system.web Specifies the root element for the ASP.NET configuration settings in a configuration file and contains configuration elements that configure ASP.NET Web applications and control how the applications behave.

Syntax Example

The following example shows how to specify several page configuration settings.

<configuration>
   <system.web>
      <pages
         buffer = "true"
         enableSessionState = "true"
         autoEventWireup = "true"
         maintainScrollPositionOnPostBack = "true"
         masterPageFile = "~/Masters/Page1.master" />
   </system.web>
</configuration>
See Also

ASP.NET Configuration   PagesSection Class



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note