New ASP.NET Page Directives

JavaScript Editor jscript editor     Web designer 



Main Page

In previous versions of ASP, it was possible to place a single directive on the first line of a page. For example:

В CopyCode imageCopy Code
<%@LANGUAGE="VBScript" CODEPAGE="932"%>

Several new directives have been added to ASP.NET. The Language attribute must now be placed within an @ Page directive, as shown in the following code example.

В CopyCode imageCopy Code
    <%@Page Language="VB" CodePage="932"%>
    <%@OutputCache Duration="10 VaryByParam="location"%>

For migration purposes, the following shorter ASP–style syntax is also supported for the @ Page directive only.

В CopyCode imageCopy Code
    <%@ Language="VB" CodePage="932"%>
    <%@OutputCache Duration="10 VaryByParam="location"%>

Directives can be located anywhere in an .aspx file, but standard practice is to place them at the beginning of the file. Case is not important in ASP.NET directive statements, and quotation marks are not required around the attribute values. The @ Page directive shown in the preceding example can also be written as follows:

В CopyCode imageCopy Code
<%@PAGE LANGUAGE=VB CODEPAGE=932%>

For more information about the new directives and their attribute sets, see Directive Syntax.

See Also

Reference

Directive Syntax

Other Resources

Migrating ASP Pages to ASP.NET



JavaScript Editor jscript editor     Web designer