The @ Page directive defines page-specific attributes used by the ASP+ page parser and compiler.
<%@ Page attribute=value [attribute=value … ]%>
Note Multiple Page directives in a single .aspx file are not allowed. You can only have one Page directive per file. To define multiple attributes, use a space-separated list, with no space around the equals sign, as in TRACE="True"
.
The following attribute/value pairs are supported. Default values are underlined.
Attribute | Supported Values | Description |
---|---|---|
BUFFER | True, False | Defines HTTP response buffering semantics. |
CODEPAGE | Any valid code page value | Indicates the locale codepage value for the ASP+ page. |
CONTENTTYPE | Any valid HTTP content type string | Defines the HTTP content type of the response as a standard MIME type. |
CULTURE | Any valid culture string | Indicates the culture setting for the page. |
DESCRIPTION | Any string description | Provides a text description of the page. |
ENABLESESSIONSTATE | True, False, ReadOnly | Defines session state requirements. |
ERRORPAGE | Any valid HTTP URL | Defines target URL for redirection if an un-handled page exception occurs. |
INHERITS | Any class derived from the Page Class class. | Code-behind class for page to inherit. |
LANGUAGE | VB, C#, JavaScript | Language used when compiling all <% %> and <%= %> blocks within the page. |
LCID | Any valid LCID value | Defines the locale identifier for code in the page. |
MAINTAINSTATE | True, False | Indicates whether view state should be maintained across page requests. |
RESPONSEENCODING | Values from Encoding.GetEncoding | Response encoding of content. |
SRC | Source file name | Code-behind class to compile. |
TRACE | True, False | Indicates whether tracing is enabled. |
TRANSACTION | NotSupported, Supported, Required, RequiresNew | Indicates the transaction semantics. |
WARNINGS | True, False | If true, indicates that compiler warnings should be treated as errors; otherwise ignored. |
Example
<%@ Page Language=”VB” ContentType=”text/xml”%>
The preceding code instructs the ASP+ page compiler to use Visual Basic as the inline code language and sets the default HTTP MIME ContentType transmitted to the client to be “text/xml”.
See Also
ASP+ Page Syntax | Directives