Home » ASP.NET Basics » 01 - Introduction to ASP.NET 2.0
1

Static and Dynamic Web Pages

Differentiating static and dynamic web pages

In the early stages of web development, web pages were created using HTML. These pages typically consist of some text, images and links. HTML pages can be created easily using a text editor (such as Notepad, for example). All that is needed is to type the code and save the file with .htm or .html extension. Here is an example:

 <html> <head> <title>My Home Page</title> </head> <body> <h1>Welcome to My Home Page</h1> Today is Friday, September 15, 2006. </body> </html> 

The above text is a simple HTML code, typed in Notepad. Let us save this file as `sample.html'.

When we open this file in a browser, it is displayed as shown in the figure:

HTML consists of different tags for formatting the display of a page. We can make the page more interesting by adding tags for colors, fonts, backgrounds, images, etc. However, there is a problem with this page. This page is static. No matter which date a user views this page, she will always see the date as Friday, September 15, 2006.

This is the major disadvantage of static HTML pages. Their contents are fixed for every user, all the time. To change the content, we need to modify the page. It may be relatively easy to change the date everyday but what if we want to display the current time? There is no way to find out what the specific time is when a user views a page. Similarly, how are we going to get some information from the user? How can we personalize the site for each user? Early HTML does not have an answer to these questions.

HTML 2.0 introduced the concept of `HTML Forms'. HTML forms allow the use of `controls' along with tags. Controls are used for user interaction. It includes elements like text box, button, drop-down list and check boxes. Let us make a simple HTML form:

 <html> <head> <title>My Home Page</title> </head> <body> <h1>Welcome to My Home Page</h1> Today is Friday, September 15, 2006. <hr> <form> Please Enter Your Name: <input type="text"> <input type="submit" value="Submit"> </form> </body> </html>

This is how the page looks like in the browser: -

As we can see, there is a text box on the page where the user can enter his or her name and then click on the submit button for further processing.

HTML Forms have made it possible to obtain user input but processing this input was a difficult task. All the input provided by the user (for example, names and address in different text boxes, any choices made using check boxes or drop-down lists) was first converted into text form, like a long sentence, before it can be processed using two different options.

The first option was to send this text to an email address, where, upon receiving, someone had to separate the different parts of the input manually to make it meaningful. This was a time consuming process, especially if many users visited that web page daily.

The second option was to write an application to handle the input. The application was generally developed using Common Gateway Interface (CGI) scripting. CGI scripting required good programming skills and had some limitations.

With the introduction of new technologies like JavaScript and VBScript, a new dimension was added to web development. These scripting languages enabled web developers to create more interactive pages. Now it became possible to display message boxes, update the date, time, and add various other dynamic contents on a web site. Such pages are called Dynamic web pages.

There are two types of scripting available to web developers. Scripts that run on the user's browser are called client-side scripts, and scripts that run on the web server are called server-side scripts.

We will soon explore the two types of scripting but before that, let us learn a little more about web servers.

A Web servers is a piece of software used for managing web pages. A web developer creates the web pages and stores them on a computer running a web server software. When a user requests for that page by typing its URL in the browser, the browser sends this request to the related web server. The web server then processes the request and sends the web page back to the browser. Two very popular web server softwares are Microsoft's IIS (Internet Information Services) and Apache.

Why is this discussion of web servers important for us? In the coming lessons, we are going to create ASP.NET 2.0 web applications and we need a web server installed on our computer in order to test them. IIS is Microsoft's recommended web server but it is not necessary to have IIS installed in order to test ASP.NET 2.0 applications. Visual Web Developer Express 2005 (the development tool we are going to use for creating web applications) includes its own web server. This is a great feature of Visual Web Developer Express because not all the versions of Windows OS support IIS.

To continue with our topic on scripting, let us take a quick look at the two different types of scripting.