[ This book has been updated! Check out the latest edition. ]
If you’re preparing to write your first ASP.NET 2.0 web site using C# or VB.NET, and SQL Server 2005 databases, let this practical tutorial show you the way!
Many have complained that historically, Microsoft’s operating systems seemed to be created more for programmers than for home users. While this may or may not be true, what I’m pretty confident about is that .NET 2.0 and SQL Server 2005 certainly seem to have been created with the programmer in mind. They’re flexible, incredibly powerful, and beautiful to work with!
As you probably know, this is not my first ASP.NET 2.0 & SQL Server 2005 book. While my other ASP.NET books have received overwhelmingly positive feedback over the time, I have always wanted to write a tutorial for the beginner creating his or her first Web Application using Microsoft’s latest technologies.
Build Your Own ASP.NET 2.0 Web Site Using C# and VB is exactly that: a friendly tutorial that will teach you, step by step, all the foundations necessary to start creating your own ASP.NET web sites. Because nothing interesting can be done without a database, a large part of the book is dedicated to SQL Server 2005, and to the interaction between ASP.NET and the database server.
This ASP.NET 2.0 tutorial shows you how to obtain, install and configure the software you’ll need. They it introduces you to the ASP.NET framework, VB and C#, and guides you through the process of building a fully functional web application. All you need to get started is an understanding of HTML and the basics of web site design – you won’t need to spend a cent on software.
The book has been completely revised for ASP.NET 2.0, with greatly expanded coverage of best practice techniques like code-behind, usage of Visual Web Developer and SQL Server Express Edition, and coverage of powerful new ASP.NET 2.0 functionality, including the GridView control and Master Pages.
This book will show you how to:
- Install the free software that you need.
- Use Visual Web Developer.
- Program in both VB and C#.
- Write best practice code and use code-behind.
- Use CSS to style your ASP.NET pages.
- Build a complete web application: the Dorknozzle intranet site.
- Validate input using the Validation Controls.
- Learn database design and SQL using SQL Server Express Edition.
- Manage page content using the GridView and DetailsView controls.
- Secure your applications with Memberships and Roles.
- Work with files and email.
Table of Contents
Chapter 1: Introducing ASP.NET
Before you can start building your database-driven Web presence, you must ensure you have the right tools for the job. In this first chapter, you’ll learn how to find, download, and configure the .NET Framework. You’ll learn where the Web server is located and how to install and configure it. Next, we’ll walk through the installation of the Microsoft database solution: SQL Server 2005. Finally, we’ll create a simple ASP.NET page to make sure that everything’s running and properly configured.
Chapter 2: ASP.NET Basics
Here you’ll create your first useful ASP.NET page. We’ll cover all of the parts that make up a typical ASP.NET page, including directives, controls, and code. We’ll then walk through the process of deployment, focusing specifically on allowing the user to view the processing of a simple ASP.NET page through the Web browser.
Chapter 3: VB.NET and C# Programming Basics
In this chapter, we’ll look at two of the programming languages used to create ASP.NET pages: VB.NET and C#. You’ll learn about the syntax of the two languages as we explore the concepts of variables, data types, conditionals, loops, arrays, functions, and more. Finally, we’ll see how the two languages accommodate Object Oriented Programming (OOP) principles by allowing you to work with classes, methods, properties, inheritance, and more.
Chapter 4: Constructing ASP.NET Web Forms
Web Forms are the ASP.NET equivalent of web pages but, as you'll see, building ASP.NET Web Forms is a lot like composing a castle with Lego bricks! ASP.NET is bundled with hundreds of controls - including HTML controls, Web controls, and so on - that are designed for easy deployment within your applications. This chapter will introduce you to these building blocks. You’ll also learn your own Web User Controls, and how to work with Master Pages, which are a very exciting new feature in ASP.NET 2.0.
Chapter 5: Building Web Applications
A Web Application is basically a group of Web Forms, controls, and other elements, that work together to achieve complex functionality. So it's no surprise than when building Web Applications, there are more things to consider than when building individual Web Forms. This chapter touches on those topics, beginning with a hands-on tour of the free IDE from Microsoft, called Visual Web Developer 2005 Express Edition. Then, you'll learn how to configure your Web Application the Web.config configuration file, how to use the application state, user sessions and cookies, how to debug your project, and more.
Chapter 6: Using the Validation Controls
This chapter introduces validation controls. With validation controls, Microsoft basically eliminated the heartache of fumbling through and configuring tired, reused client-side validation scripts.
Chapter 7: Database Design and Development
Undoubtedly one of the most important chapters in the book, Chapter 7, Database Design and Development will help you prepare to work with databases in ASP.NET. We’ll cover the essentials you’ll need in order to create a database using SQL Server 2005 Express Edition. Also in this chapter, we’ll begin to build the database the Dorknozzle intranet project.
Chapter 8: Speaking SQL
This chapter will teach you to speak the language of the database: Structured Query Language, or SQL. After a gentle introduction to the basic concepts of SQL, we’ll move on to more advanced topics such as expressions, conditions, and joins. Finally, we'll take a look at how we can reuse queries quickly by writing stored procedures.
Chapter 9: ADO.NET
The next logical step in building database driven Web applications involves learning ADO.NET, the technology that facilitates communication between your Web Application and the SQL database server. This chapter explores the essentials of the technology, and will have you reading data in a database directly from your Web applications in just a few short steps. We’ll then help you begin the transition from working with static applications to those that are database-driven.
Chapter 10: Displaying Content Using Data Lists
Taking ADO.NET further, this chapter shows you how to utilize the DataList control provided within the .NET Framework. DataList plays a crucial role in simplifying the presentation of information with ASP.NET. In learning how to present database data within your applications in a cleaner and more legible format, you’ll gain an understanding of the concept of data binding at a higher level.
Chapter 11: Managing Content Using GridView and DetailsView
This chapter explores two of the most powerful data presentation controls of ASP.NET: GridView and DetailsView. GridView supersedes the ASP.NET 1.x’s DataGrid, and is a very complex control which automates almost all tasks that involve displaying grids of data. DetailsView completes the picture by offering us the functionality needed to display the details of a single grid item.
Chapter 12: Advanced Data Access
This chapter explores a few of the more advanced details involving data access, retrieval, and manipulation. We'll start by looking at direct data access using ADO.NET's data source controls. We'll then compare this approach with that of using data sets to access data in a disconnected fashion. In this section, you'll learn how to implement features such as paging, filtering, and sorting using custom code.
Chapter 13: Security and User Authentication
This chapter will show you how to secure your ASP.NET Web applications. We’ll discuss the various security models available, including IIS, Forms, Windows, and Passport, and explore the roles that the Web.config and XML files can play. This chapter will also introduce you to the new ASP.NET 2.0 membership model, and the new ASP.NET 2.0 login controls.
Chapter 14: Working with Files and Email
In this chapter, we’ll look at the task of accessing your server’s file system, including drives, files, and the network. The chapter will then show you how to work with file streams to create text files, write to text files, and read from text files on your Web server. Finally, you’ll learn how to send emails using ASP.NET.
Appendix A: Web Control Reference
Included in this book is a handy web control reference, which lists the most common properties and methods of the most frequently used controls in ASP.NET, starting with the base class WebControl. Many of the new ASP.NET 2.0 controls are covered.
Standard Web Controls: AdRotator, BulletedList, Button, Calendar, CheckBox, CheckBoxList, DropDownList, FileUpload, HiddenField, HyperLink, Image, ImageButton, ImageMap, Label, LinkButton, ListBox, Literal, MultiView, Panel, PlaceHolder, RadioButton, RadioButtonList, TextBox, Xml.
Validation Controls: CompareValidator, CustomValidator, RangeValidator, RegularExpressionValidator, RequiredFieldValidator, ValidationSummary.
Navigation Web Controls: SiteMapPath, Menu, TreeView.
HTML ServerControls: HtmlAnchor, HtmlButton, HtmlForm, HtmlGeneric, HtmlImage, HtmlInputButton, HtmlInputCheckBox, HtmlInputFile, HtmlInputHidden, HtmlInputImage, HtmlInputRadionButton, HtmlInputText, HtmlSelect, HtmlTable, HtmlTableCell, HtmlTableRow, HtmlTextArea.