Visual C# 2005 How to Program, 2/e
This is the first in a series of four tutorials that introduces ASP.NET 2.0 and Microsoft's Visual Web Developer Express IDE for building Web applications. The Visual Web Developer Express functionality we discuss is also part of the complete Visual Studio 2005. Both Visual Web Developer Express and Visual Studio 2005 were released in November 2005. This series of tutorials is a small part of Chapter 21, ASP.NET, Web Forms and Web Conrols, from our book Visual C# 2005 How to Program, 2/e. Chapter 21 is part of a four chapter sequence on XML, ADO.NET, ASP.NET and Web Services in which we discuss each of these technologies and demonstrate how to build substantial, data driven Web applications.
Part 1 of this tutorial provides a brief introduction to ASP.NET, Web Forms and Web controls. Part 2 discusses simple HTTP transactions that enable client/server interactions on the Web. Part 3 overviews multitier application architecture. Part 4 presents a simple Web Form example, analyzes its parts, shows how it executes, and discusses how to build and deploy the Web Form. The tutorials in this series are intended for students and professionals who are already familiar with Visual C# programming.
[Note: This series of tutorials is an excerpt (Sections 21.1-21.4) of Chapter 21, ASP.NET, Web Forms and Web Controls (pp. 1051-1070), from our textbook Visual C# 2005 How to Program, 2/e. These tutorials may refer to other chapters or sections of the book that are not included here. Permission Information: Deitel, Harvey M. and Paul J., Visual C# 2005 How to Program, 2/e ©2005. Electronically reproduced by permission of Pearson Education, Inc., Upper Saddle River, New Jersey.]
21.1 Introduction to ASP.NET
In previous chapters, we used Windows Forms and Windows controls to develop Windows applications. In this chapter, we introduce Web application development with Microsoft's ASP.NET 2.0 technology. Web-based applications create Web content for Web browser clients. This Web content includes Extensible HyperText Markup Language (XHTML), client-side scripting, images and binary data. Readers not familiar with XHTML should first read Appendix F, Introduction to XHTML: Part 1, and Appendix G, Introduction to XHTML: Part 2, before studying this chapter.
We present several examples that demonstrate Web application development using Web Forms, Web controls (also called ASP.NET server controls) and C# programming. Web Form files have the filename extension .aspx and contain the Web page's GUI. You customize Web Forms by adding Web controls including labels, text boxes, images, buttons and other GUI components. The Web Form file represents the Web page that is sent to the client browser. From this point onward, we refer to Web Form files as ASPX files.
Every ASPX file created in Visual Studio has a corresponding class written in a .NET language, such as C#. This class contains event handlers, initialization code, utility methods and other supporting code. The file that contains this class is called the code-behind file and provides the ASPX file's programmatic implementation.
To develop the code and GUIs in this chapter, we used Microsoft Visual Web Developer 2005 Express-an IDE designed for developing ASP.NET Web applications. Visual Web Developer and Visual C# 2005 Express share many common features and visual programming tools that simplify building complex applications, such as those that access a database (presented in Sections 21.7 and 21.8). The full version of Visual Studio 2005 includes the functionality of Visual Web Developer, so the instructions we present for Visual Web Developer also apply to Visual Studio 2005. Note that you must install either Visual Web Developer 2005 Express (available from msdn.microsoft.com/vstudio/express/vwd/default.aspx
) or a complete version of Visual Studio 2005 to implement the programs in this chapter and Chapter 22, Web Services. The site www.deitel.com/books/csharphtp2/
provides instructions for running the ASP.NET 2.0 examples presented in this chapter if you do not wish to recreate them.
Tutorials in This Series:
ASP.NET Tutorial Part 1: Introduction to ASP.NET (You are here.)
ASP.NET Tutorial Part 2: Simple HTTP Transactions
ASP.NET Tutorial Part 3: Multitier Application Architecture
ASP.NET Tutorial Part 4: Creating and Running a Simple Web Form Example