ASP 101 - Active Server Pages 101 - Web01
The Place ASP Developers Go!

Please visit our partners

Windows Technology Windows Technology
15 Seconds
ASP 101
ASP Wire
VB Forums
VB Wire
internet.commerce internet.commerce
Partners & Affiliates

ASP 101 is an site
ASP 101 is an site
Internet News
Small Business
Personal Technology

Corporate Info
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash

 Top ASP 101 Stories Top ASP 101 Stories
The Top 10 ASP Links @
What is and Why Do I Need It?
An Overview of ASP.NET

Variable Name Prefixes
Show All Tips >>
ASP 101 RSS Feed ASP 101 Updates

Build Your Own ASP.NET Website Using C# & VB.NET

from SitePoint


Here I am, seven years after the inception of ASP, still using a technology that I initially only glanced over as I searched for a server-side alternative to ColdFusion.

It was 1997, a big year for me. I graduated college, landed a job as a creative director, and decided it was time to build on my experience with HTML and JavaScript. I didn’t consider myself a programmer—my true passions lay in design—but within months of starting my new job, I was developing the firm’s Website, Intranet, and company portal. The dynamic portions of these projects were developed using CGI written in Perl. As you might expect, I was lost! After looking around, I decided ColdFusion was my best bet—the language seemed to parallel closely the constructs of HTML, and I found it easy to pick up. However, I soon discovered that ColdFusion’s limitations in terms of accessing a server’s file system, and error handling, posed problems.

ASP and VBScript seemed like the best alternative. I’d taken basic programming classes in college, and I guess they helped, because these two technologies came easily to me. Shortly thereafter, I went back to school and got into Visual Basic, COM, DCOM, and more. A whole new world was opening up to me through simplicity offered by ASP.

Seven years, and countless Windows, Web, and wireless applications later, I still swear by the next generation of a technology that I’ve always considered superior to the major alternatives. ASP.NET represents a new and efficient way of creating Web applications using the programming language with which you feel most comfortable. Though it can take some time to learn, ASP.NET is simple to use. Whether you want to create Web Forms complete with Web and validation controls, or you aim to build a feature-rich shopping cart using DataTables, all the tools you’ll need to get up and running are immediately available, easy to install, and require very little initial configuration.

My guess is that if you’re reading this book, you’re in the same boat I was: a longtime designer dabbling with HTML. Or maybe you’re an advanced HTML and JavaScript developer looking to take the next step. Perhaps you’re a seasoned PHP, JSP, or ColdFusion veteran who wants to know what all the fuss is about. Whatever the case, I’m sure you’ll find this book helpful in showing you how simple and feature-rich ASP.NET really is.

Who Should Read This Book?

This book is aimed at beginner, intermediate, and advanced Web designers looking to make the leap into server-side programming with ASP.NET. You’ll be expected to feel comfortable with HTML, as very little explanation is provided here.

By the end of this book, you should have a firm grasp on what it takes to download and install ASP.NET and the .NET Framework, configure and start your Web server, create and work with basic ASP.NET pages, install and run either Access or MSDE, create database tables, work with advanced, dynamic ASP.NET pages that query, insert, update, and delete information within a database.

All examples provided in the book are written in both Visual Basic .NET and C#, the two most popular languages for writing ASP.NET Websites. They start at beginners’ level and work up. As such, no prior knowledge of the two languages is required in order to read, learn from, and apply the knowledge provided in this book. Experience with other programming or scripting languages (such as JavaScript) will certainly grease the wheels, however, and will enable you to grasp the fundamental programming concepts more quickly.

What’s Covered In This Book?

This book is comprised of the following seventeen chapters. Read them from beginning to end to gain a complete understanding of the subject, or skip around if you feel you need a refresher on a particular topic.

Chapter 1: Introduction to .NET and 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, I’ll tell you how to find, download, and configure the .NET Framework. I’ll explain where the Web server is located and how to install and configure it. Next, we’ll walk through the installation of two Microsoft database solutions: Access and MSDE. Finally, we’ll create a simple ASP.NET page to make sure that everything’s running and properly configured.

Chapter 2: ASP.NET Basics

In this chapter, 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 principles by allowing you to work with classes, methods, properties, inheritance, and more.

Chapter 4: Web Forms and Web Controls

ASP.NET is bundled with hundreds of controls that you can use within your applications, including HTML controls, Web controls, and more. This chapter will introduce you to the wonderful world of Web controls and how Microsoft basically reinvented HTML forms.

Chapter 5: 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 6: Database Design and Development

Undoubtedly one of the most important chapters in the book, Chapter 6, 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 either Access or MSDE. In this chapter, we’ll begin to build the database for our project.

Chapter 7: Structured Query Language

This chapter introduces the language we’ll use to facilitate communications between the database and the Web application: 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.

Chapter 8: ADO.NET

The next logical step in database driven Web applications involves ADO.NET. 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 database-driven ones.

Chapter 9: The DataGrid and DataList Controls

Taking ADO.NET further, this chapter shows you how to utilize the DataGrid and DataList controls provided within the .NET Framework. DataGrid and DataList play a crucial role in the simplicity of presenting 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 much higher level.

Chapter 10: DataSets

One of the most challenging concepts to grasp when transitioning from ASP to ASP.NET is that of disconnected data. In this chapter, you’ll learn how to use DataSets to create virtual database tables within your Web applications. You’ll also learn how to work with DataTables, and how to filter and sort information within DataSets and DataTables using DataViews.

Chapter 11: Web Applications

Chapter 11, Web Applications explores the features of a Web application. We’ll discuss the many parts of the Web.config file in depth, and understand how to work with the Global.asax file, application state, and session state. Finally, we’ll look at the ways in which caching can improve the performance of your Web applications.

Chapter 12: Building an ASP.NET Shopping Cart

In this chapter, we’ll create an ASP.NET shopping cart. Using the topics we’ve explored in previous chapters, including DataTables and session state, we’ll walk through the process of building a purely memory-resident shopping cart for our project.

Chapter 13: Error Handling

Learning to handle gracefully unforeseen errors within your Web applications is the topic of this chapter. Initially, we’ll discuss basic page and code techniques you can use to handle errors. We’ll then talk about the debugger that’s included with the .NET Framework SDK and understand how to leverage it by setting breakpoints, reading the autos and locals window, and setting watches. Finally, we’ll discuss how you can take advantage of the Event Viewer to write errors as they occur within your applications.

Chapter 14: Security and User Authentication

This chapter will introduce you to securing your Web applications with ASP.NET. Here, we’ll discuss the various security models available, including IIS, Forms, Windows, and Passport, and discusses the roles the Web.config and XML files can play.

Chapter 15: Working with Files and Email

In this chapter, we’ll look at 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.

Chapter 16: Rich Controls and User Controls

Chapter 16, Rich Controls and User Controls explores ASP.NET’s rich controls. You’ll learn how to create an interactive meeting scheduler using the Calendar control, sessions, and serialization. You’ll also learn how to format XML with XSLT utilizing the Xml control. Lastly, we’ll look at randomizing banner advertisements on your site using the AdRotator control.

Chapter 17: XML Web Services

The newest buzzword in the development community is “Web Services,” and this chapter hopes to shed some light on the topic. We first define Web Services before moving on to explain how they’re used, where they can be found, and what WSDL and UDDI are. In this chapter, you’ll create a couple of different Web Services from scratch, including one that queries your database to present information within a Web application. You’ll also learn how to build a search application using the Google Search Web Service.

The Book’s Website

Located at, the Website that supports this book will give you access to the following facilities:

The Code Archive

As you progress through this book, you’ll note a number of references to the code archive. This is a downloadable ZIP archive that contains complete code for all the examples presented in the book.

The archive contains one folder for each chapter of the book. Each of these folders in turn contains CS and VB subfolders, which contain the C# and VB.NET versions of all the examples for that chapter, respectively. In later chapters, these files are further divided into two more subfolders: Lessons for standalone examples presented for a single chapter, and Project for files associated with the Dorknozzle Intranet Application, a larger-scale project that we’ll work on throughout the book, which I’ll introduce in Chapter 4, Web Forms and Web Controls.

Updates and Errata

No book is perfect, and we expect that watchful readers will be able to spot at least one or two mistakes before the end of this one. The Errata page on the book’s Website will always have the latest information about known typographical and code errors, and necessary updates for new releases of ASP.NET and the various Web standards that apply.

The SitePoint Forums

If you’d like to communicate with me or anyone else on the SitePoint publishing team about this book, you should join SitePoint’s online community. The .NET forum in particular can offer an abundance of information above and beyond the solutions in this book.

In fact, you should join that community even if you don’t want to talk to us, because there are a lot of fun and experienced Web designers and developers hanging out there. It’s a good way to learn new stuff, get questions answered in a hurry, and just have fun.

The SitePoint Newsletters

In addition to books like this one, SitePoint publishes free email newsletters including The SitePoint Tribune and The SitePoint Tech Times. In them, you’ll read about the latest news, product releases, trends, tips, and techniques for all aspects of Web development. If nothing else, you’ll get useful ASP.NET articles and tips, but if you’re interested in learning other technologies, you’ll find them especially valuable. Sign up to one or more SitePoint newsletters at

Your Feedback

If you can’t find your answer through the forums, or if you wish to contact us for any other reason, the best place to write is . We have a well-manned email support system set up to track your inquiries, and if our support staff members are unable to answer your question, they will send it straight to me. Suggestions for improvements as well as notices of any mistakes you may find are especially welcome.


First and foremost, I’d like to thank the SitePoint team for doing such a great job in making this book possible, for being understanding as deadlines inevitably slipped past, and for the team’s personal touch, which made it a pleasure to work on this project.

Particular thanks go to Simon Mackie, whose valuable insight and close cooperation throughout the process has tied up many loose ends and helped make this book both readable and accessible. Thanks again Simon for allowing me to write this book—I appreciate the patience and dedication that you’ve shown.

Finally, returning home, I’d like to thank my wife Jessica, whose patience, love and understanding throughout continue to amaze me.

Excerpted from the book "Build Your Own Database-Driven Website Using C# & VB.NET". Learn to create ASP.NET Websites from scratch using freely available software. Copyright 2004 SitePoint Pty Ltd.

Build Your Own Database-Driven Website Using C# & VB.NET

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback
The Network for Technology Professionals



Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers