ASP.NET Page Syntax

The topics in this section describe the markup syntax that you can use to declaratively create ASP.NET pages or user controls, which are text files that have .aspx or .ascx file name extensions, respectively.

An ASP.NET page is defined as a file in a Web application with an .aspx file name extension with an HTML form element that specifies runat="server". You can optionally specify an @ Page directive or other directive (as appropriate to the type of page that you are creating), one or more Web server controls, and server code.

Note

The mapping of file name extensions to ASP.NET is done by Internet Information Services (IIS).

Note

You must include your HTML form element within <html> and <body> tags. Some browsers will return an error if you exclude these tags.

Note

If you want your pages to conform to XHTML standards, you must include additional elements, such as a DOCTYPE element. For details, see XHTML Standards in Visual Studio and ASP.NET.

The following example shows a basic ASP.NET page.

<%@ Page Language="VB" %>
<html>
  <body>
    <form runat="server">
    </form>
  </body>
</html>

In This Section