Share via


ASP to ASP.NET Page Directive Changes

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

<%@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.

    <%@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.

    <%@ 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:

<%@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 to ASP.NET