Поделиться через


<pages> Element

Identifies page-specific configuration settings. The <pages> section can be declared at the machine, site, application, and subdirectory levels.

<configuration>
   <system.web>
      <pages>

<pages buffer="true|false" 
       enableSessionState="true|false|ReadOnly"
       enableViewState="true|false"
       enableViewStateMac="true|false"
       autoEventWireup="true|false"
       smartNavigation="true|false"
       pageBaseType="typename, assembly"
       userControlBaseType="typename"
       validateRequest="true|False"/>

Optional Attributes

Attribute Option Description
buffer     Specifies whether the URL resource uses response buffering.
    true Indicates that response buffering is enabled.
    false Indicates that response buffering is not enabled.
enableSessionState     Specifies whether session state is enabled.
    true Indicates that session state is enabled.
    false Indicates that session state is not enabled.
    ReadOnly Specifies that an application can read but cannot modify session state variables.
enableViewState     Specifies whether view state is enabled.
    true Indicates that view state is enabled.
    false Indicates that view state is not enabled.
enableViewStateMac     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. A view state MAC is an encrypted version of the hidden variable that a page's view state is persisted to when sent to the browser. If true, the encrypted view state is checked to verify that it has not been tampered with on the client.
    true Indicates that view state is MAC checked.
    false Indicates that view state is not MAC checked. The default is false.
smartNavigation     Specifies whether smart navigation is enabled. Smart navigation requires Microsoft Internet Explorer 5.5 or greater.
    true Indicates that smart navigation is enabled.
    false Indicates that smart navigation is not enabled. The default is false.
pageBaseType     Specifies a code-behind class that .aspx pages inherit by default.
userControlBaseType     Specifies a code-behind class that user controls inherit by default.
autoEventWireup     Indicates whether page events are automatically enabled.
    true Indicates that page events are automatically enabled.
    false Indicates that page events are not automatically enabled.
validateRequest     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.
    true Indicates that input from the browser is checked. The default is true.
    false Indicates that input from the browser is not checked.

Example

The following example specifies several page configuration settings.

<configuration>
   <system.web>
      <pages buffer="true"
             enableSessionState="true"
             autoEventWireup="true"
             smartNavigation="true"/>
   </system.web>
</configuration>

Requirements

Contained Within: <system.web>

Web Platform: IIS 5.0, IIS 5.1, IIS 6.0

Configuration File: Machine.config, Web.config

Configuration Section Handler: System.Web.UI.PagesConfigurationHandler

See Also

ASP.NET Configuration | ASP.NET Settings Schema