The Page Class

An ASP.NET page consists of, at a minimum, a single file with an extension of .aspx, though typically, other files will be associated with the page, as we will describe later. In the parlance of Visual Studio 2008 (VS2008), this .aspx file is called the content file, because it contains primarily the visual content of the page, that is, HTML, text, and ASP.NET server controls.

Warning

Do not confuse the content file nomenclature, as used in this context, with the use of the same term when talking about master pages, where the content file is replaceable content that is inserted onto a master page. We use the terms markup page and code-behind file to help prevent confusion. We cover master pages in Chapter 13.

Any content in the content file that is not part of a server control or server-side code is treated as normal HTML markup. It is passed from the server to the browser exactly as is, so the browser can deal with it as it would any other HTML.

The .aspx file can contain script blocks. These are written in a scripting (noncompiled) language, such as JavaScript or VBScript, which will execute on the client (i.e., the browser, if it supports that scripting language—JavaScript is ubiquitous; VBScript is Internet Explorer-only). It may also contain server-side code blocks, written in any .NET supported language, such as C# or Visual Basic, though these code blocks are more commonly contained in a separate code-behind file, as we will describe in the next section.

When a ...

Get Programming ASP.NET 3.5, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.