ASP.NET

HyperText Markup Language (HTML)

In the course of looking at ASP.NET, we'll see quite a bit of HTML. Most of it will be generated by the ASP.NET server-side controls. However, it's important to understand HTML because you may want to write your own server-side control from scratch, and at times you may need to tweak or debug the output of your ASP.NET application.

Most HTTP requests result in a stream of text coming back to the caller. The world has pretty much agreed that HTML is the language for formatting documents, and most browsers understand HTML.

The first release of HTML worth using was version 2.0. Version 3.2 included many new features, such as tables, applets, text flow around images, and superscripts and subscripts, while providing backwards compatibility with the existing HTML 2.0 Standard.

The bottom line is that given a competent browser and well-structured HTML, you had the beginnings of a user interface development technology. And because HTML was understood by browsers running on a variety of platforms, the door was open for implementing a worldwide interactive computing platform. The other key that made this happen (besides a mature version of HTML) was the ability of servers to adapt their output to accommodate the requests of specific users at runtime.

For example, the HTML stream shown in Listing 1-3 will render an HTML page containing a button and a combo box filled with options. (This file is named SelectNoForm.htm in the collection of examples for this tutorial.)

Listing 1-3

<html>
 <body>
   <h2>Hello there. What's your favorite .NET feature?</h2>
   <select name='Feature'>
    <option> Type-Safety</option>
    <option> Garbage collection</option>
    <option> Multiple syntaxes</option>
    <option> Code Access Security</option>
    <option> Simpler threading</option>
    <option> Versioning purgatory</option>
   </select>
   </br>
   <input type=submit name='Lookup' value='Lookup'></input>
  </br>
 </body>
</html>

See Figure 1-1 for an example of how the page looks when rendered by the browser.

Figure 1-1 A simple HTML page showing a selection tag (rendered here as a Windows combo box) and a Submission button.
Figure 1-1 A simple HTML page showing a selection tag (rendered here as a Windows combo box) and a Submission button.
NOTE
We'll actually surf to an HTML file in subsequent tutorials. Getting to that point is a bit involved, so for now, you can trust that the HTML will render in this fashion.

This is a static page. Even though it has a combo box and a button, they don't do anything worthwhile. You can pull down the combo box and work with it inside the browser. You can push the button, but all the action happens locally. That's because the server on the other end needs to support dynamic content.