Tutorial Objectives:

       •        Understand the basic architecture of a Web application
       •        Learn the key features of ASP.NET 3.5
       •        Contrast the use of IIS vs. the Visual Studio 2008 development Web server
       •        Work with different versions of IIS
       •        Know the differences between a Visual Studio 2008 Web Site and a Web Application project
       •        Know the architecture of an ASP.NET Web page
       •        Work with members of the Page class
       •        Interact with the Page class events
       •        Explore the single-file and code-behind models
       •        Investigate the ASP.NET folders
       •        Understand the basics of Web.config
       •        Perform debugging and tracing
       •        Research the global.asax file
       •        Understand the ASP.NET Web control event architecture
       •        Contrast HTML Server Controls with Web Controls
       •        Survey the categories of Web Controls
       •        Work with ASP.NET Validation Controls
       •        Examine the use of HTML tables and CSS to provide exact positioning of Web content


Other than its name, Microsoft’s ASP.NET Web technology has very little in common with its predecessor,
Active Server Pages (ASP).  For example, ASP Web pages were created using server-side script - either with
VBScript or JScript. The script was interpreted at run time to dynamically produce Web pages containing
HTML and JavaScript.

ASP.NET creates Web pages dynamically, containing HTML and JavaScript, but with the Object-Oriented
(OO) benefits of the .NET framework with C# and VB. Additionally, Visual Studio 2008 allows ASP.NET
developers to employ the same development techniques used when building Windows applications. For
example, a developer can “drag and drop” controls to the designer surface, set control properties, create event
handlers, create an installer and more.

This chapter introduces the world of ASP.NET Web development. It examines the two different types of
Visual Studio Web applications – Web Sites and Web Application projects. It also covers some of the new
features in ASP.NET 3.5 and explores the new user interface of IIS 7.0.

The Architecture of a Web Application                                       
         
A Web application follows the same architecture as a client/server application, which is based on the
request/response paradigm. The client (usually a Web browser) is simply a computer that wants information.
Information sent from the Web client to the Web server is termed the ‘request’. The server is simply a
computer that has the information desired by others. Information sent from the Web server to the Web client
is termed the ‘response’.

The fundamental technologies used with the Web are HTTP, HTML, JavaScript, Web browsers and Web
servers.
      •      
  HTTP (Hypertext Transfer Protocol) is a stateless networking protocol used to transfer
                request/response information between a Web browser and a Web server.
      •       
 HTML (Hypertext Markup Language) is used to create Web pages, which are standard text files
                containing various pieces of text, hyperlinks, images and more.
      •        
JavaScript is a client-side scripting language that is supported by all of today’s popular Web
                browsers. If used, it will be embedded within a Web page’s HTML.
      •        A
Web browser is an application that interprets and displays Web pages.
      •        A
Web server is an application that accepts HTTP requests (usually from Web browsers) and
                returns the requested data (typically HTML documents).
























Communication between a Web client and a Web server is short. For example, a Web client (user) clicks on a
hyperlink, forming and sending a request. The Web request is passed to the Web server, which generates and
returns a response. Once the client has received the response from the Web server, the communication cycle
is complete and the connection is terminated.

At this point, the Web server has no clue what the client is doing with the information it received. Unless the
content is streamed information, no live connections are maintained between the client and the server. The
Web server doesn’t even know if the client will make another request. Web applications are typically referred
to as “stateless”.

In order to support the illusion that the client and server “know” each other, developers must use special
client-side and server-side programming techniques. These techniques are used to sustain several concurrent
Web sessions between many different Web clients with the same Web server. As you will learn later, ASP.
NET provides numerous state management techniques, such as cookies, caching, session variables, hidden
form fields, etc.

Understanding the Role of HTTP           
                                            
The Hypertext Transfer Protocol (HTTP) is the most widely used protocol on the Internet today. HTTP is a
simplified version of TCP/IP. Remember, HTTP is a stateless request/response protocol. The Web server
does not automatically remember any state information between multiple requests from the same client.

A typical client/server interaction is as follows. A client sends a request using one of the following verbs:
GET or POST. The request information includes the Uniform Resource Identifier (URI), protocol version,
request modifiers, client information and sometimes form data (For example, text box values, check boxes, and
drop-down list boxes). The server responds with the request status, the message protocol version, a success
or error code, a message containing server information and possible body content (HTML).

The POST method is used to push a message from the client to the Web server. This technique is used when:
      •        Posting a message to a bulletin board, newsgroup, etc.
      •        Posting an HTML form containing populated Web controls to the Web server.
      •        There is no limitation as to the amount of data that can be posted to the Web server.

When a form is submitted using the POST method, the form data is embedded in the HTTP header:


POST /myBookServer HTTP/1.1
Host:  www.mybooksystem.com
Cookie:  NumVisits=2&UserID=22343243
Content-Type:  text/xml
Content-Length: 500
Content:
id=73&name=Chucky


The GET verb is similar to POST except that form data is appended to the query string. The Uniform
Resource Locator (URL) with a query string looks something like this:


http://www.myserver.com/default.aspx?id=73&name=Chucky


Query strings are typically limited to 255 characters by most Web browsers. Here is an HTTP GET message
header:


8/8/00 10:20:37 Sent GET /myform/download.asp HTTP/1.1
Accept:  application/msword, image/gif, image/jpeg,
application/vnd.ms-powerpoint
Accept-Language: en-us
Referer: http://www.myserver.com/menu.asp
Cookie:  NumVisits=2&UserID=22343243
User-Agent:  Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000)
Host:  200.210.233.55
Connection:  Keep-Alive


ASP .NET hides much of the posting-centric mechanics. In most cases, you can be blissfully unaware of how
the data is passed between the client and the server. Please note that, under the hood, ASP.NET is still using
GET and POST verbs to move “stateful” message data.


ASP.NET Tutorial
Table of Contents
Copyright (c) 2008.  Intertech, Inc. All Rights Reserved.  This information is to be used exclusively as an
online learning aid.  Any attempts to copy, reproduce, or use for training is strictly prohibited.
Courseware
Training Resources
Tutorials
Services