
Structuring an ASP.NET Page | 31
Web Forms
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
• Preserve the state of the page and its controls between requests with the
inclusion of state management features. This facility is explained in detail in
the “State Management” section later in this chapter.
• Provide an extensible model that allows you to develop your own controls or
purchase third-party controls to add functionality to your application.
Structuring an ASP.NET Page
An ASP.NET page is a declarative text file with the extension .aspx. A page
consists of structural elements that can perform various operations—ultimately
resulting in output of HTML or other MIME-type output that can be handled by
the browser. An ASP.NET page can contain any or all of the following elements:
Page directives
Start with the
@ symbol, followed by attribute/value pairs, and are used to
specify page-level settings, such as the language used in the page or
namespaces to be imported. For example, the following code specifies the C#
programming language:
<%@ Page Language="C#" %>
Code declaration blocks
Consist of variable and member declarations within
<script>…</script>
tags, as follows:
<script language="C#" runat="server">
// code goes here
</script>
Note that there are limitations on what code you can place in <script> blocks
in ASP.NET. In classic ASP, you ...