To make sure were on the same page and that the code works, save this piece of
code in a file named Hello.aspx within the Learning virtual directory you created
in Chapter 1. Loading the file through http://localhost/Learning/Hello.aspx
should render the result shown in Figure 2.3.
Figure 2.3. Sample Page in action
As you can see, this ASP.NET page contains examples of all the above components
(except server-side includes) that make up an ASP.NET page. You wont often
use every single element in a given page, but its important that you are familiar
with these elements, their purposes, and how and when its appropriate to use
The directives section is one of the most important parts of an ASP.NET page.
Directives control how a page is compiled, specify how a page is cached by web
browsers, aid debugging (error-fixing), and allow you to import classes to use
within your pages code. Each directive starts with <%@. This is followed by the
directive name, plus any attributes and their corresponding values. The directive
then ends with %>.
There are many directives that you can use within your pages, and well discuss
them in greater detail later, but, for now, know that the Import and Page directives
are the most useful for ASP.NET development. Looking at the sample ASP.NET
page in Figure 2.2, we can see that a Page directive was used at the top of the
page like so:
Visual Basic File: Hello.aspx (excerpt)
<%@ Page Language="VB" %>
Chapter 2: ASP.NET Basics

Get Build Your Own ASP.NET 2.0 Web Site Using C# & VB, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.