Beginning ASP.NET 2.0 E-Commerce in C# 2005 is the evolution of its ASP.NET 1.1 edition - one of
Bookpool's most loved books of 2004.
This book not only teaches you e-commerce, but it's also a practical tutorial on real-world ASP.NET 2.0 and SQL Server 2005. The reason is simple: you can't implement a professional order pipeline and credit card processing if the site foundations aren't solid and extensible. You'll learn how to make the most out of the excellent (and free!) tools from Microsoft: Visual Web Developer 2005 Express, and SQL Server 2005 Express.
While this shouldn't be your first ASP.NET book, we did our best to carefully explain every theoretical concept and the code that implements it. We even tried to present the topics in increasing order of complexity, so that your journey through the book will be more fun and efficient.
This book is a long case study, where each chapter implements a new feature into the fictional BalloonShop web site. The e-commerce site is developed in three phases. Assuming you start the project on a low budget, the first phase will have you get the site up and running fast, receiving payments through PayPal. In the second stage you add even more features (such as automatic product recommendations), and in the last stage you add the real e-commerce code by processing credit card transactions yourself through VeriSign Payflow Pro or DataCash. Integration with Amazon's web services is also covered.
BalloonShop can be visited online at www.cristiandarie.ro/BalloonShop/. Find the detailed table of contents, two sample chapters, updated errata, and more, at http://www.cristiandarie.ro/asp20-sql-server-ecommerce/. If the errata doesn't answer your problem or if you just want to say "hi", there you can also find my email.
This shouldn't be your first book on ASP.NET. If you're a total beginner, I suggest you have a look at my ASP.NET tutorial: Build Your Own ASP.NET 2.0 Web Site Using C# & VB.
Table of Contents
Get the detailed TOC as a
PDF download.
Chapter 1: Starting an E-Commerce Site.
In this chapter you’ll see some of the principles of e-commerce in the real world. You’ll learn
the importance of focusing on short-term revenue and keeping risks down. We look at the three
basic ways in which an e-commerce site can make money. We then apply those principles to a
three-phase plan that continues to expand throughout the book, providing a deliverable, usable
site at each stage.
Chapter 2: Laying Out the Foundations.
After deciding to develop a web site, we start to look in more detail at laying down the foundations
for the future web site. We’ll talk about what technologies and tools you’ll use and, even
more important, how you’ll use them. Download this chapter in PDF format.
Chapter 3: Creating the Product Catalog: Part I.
After you’ve learned about the three-tier architecture and implemented a bit of your web site’s
main page, it’s time to continue your work by starting to create the product catalog. You’ll develop
the first database table, create the first stored procedure, implement generic data access code,
learn how to handle errors and email their details to the administrator, work with the web.config
ASP.NET configuration file, implement the business logic, and finally use data gathered from the
database through the business logic mechanism to compose dynamic content for your visitor.
Chapter 4: Creating the Product Catalog: Part II.
This chapter continues the work started in Chapter 3 by adding many new product catalog
features. Here you’ll learn about relational data and about the types of relationships that occur
between data tables, how to join data tables, how to work with stored procedures, and how to
display categories, products, and product details.
Chapter 5: Searching the Catalog.
"What are you looking for?" There is no place where you’ll hear this question more frequently
than in both brick-and-mortar and e-commerce stores. Like any other quality web store around,
your site should allow visitors to search through the product catalog. In this chapter, you’ll see
how easy it is to add new functionality to a working site by integrating the new components into
the existing architecture.
Chapter 6: Improving Performance.
Why walk when you can run? No, we won’t talk about sports cars in this chapter. Instead, we’ll
analyze a few possibilities to improve the performance of your project. Although having a serious
discussion on improving ASP.NET performance is beyond the scope of this book, in this chapter,
you’ll learn a few basic principles that you can follow to improve your web site’s performance.
Chapter 7: Receiving Payments Using PayPal.
Let’s collect some money! Your e-commerce web site needs a way to receive payments from
customers. The preferred solution for established companies is to open a merchant account,
but many small businesses choose to start with a solution that’s simpler to implement, where
they don’t have to process credit card or payment information themselves. In this chapter,
you’ll learn how to receive payments through PayPal. Download this chapter in PDF format.
Chapter 8: Catalog Administration.
The final detail to take care of before launching the site is to create the administrative interface.
In the previous chapters, you worked with catalog information that already existed in the database.
You’ve probably inserted some records yourself, or maybe you downloaded the database
information. For a real web site, both of these methods are unacceptable, so you need to write
some code to allow easy management of the web store data. In this chapter, you’ll implement a
catalog administration page. With this feature, you complete the first stage of your web site’s
development.
Chapter 9: Creating a Custom Shopping Cart.
Welcome to the second phase of development, where you’ll start improving and adding new
features to the already existing, fully functional e-commerce site. In this chapter, you’ll implement
the custom shopping basket, which will store its data into the local database. This will
provide you with more flexibility than the PayPal shopping basket, over which you have no
control and which you can’t save into your database for further processing and analysis.
Chapter 10: Dealing with Customer Orders.
The good news is that your brand-new shopping cart looks good and is fully functional. The bad
news is that it doesn’t allow visitors to actually place orders, making it totally useless in the
context of a production system. You’ll deal with that problem in this chapter, in two separate
stages. In the first part of the chapter, you’ll implement the client-side part of the order-placing
mechanism. In the second part of the chapter, you’ll implement a simple orders administration
page where the site administrator can view and handle pending orders.
Chapter 11: Making Product Recommendations.
One of the most important advantages of an online store as compared to a brick-and-mortar
store is the capability to customize the web site for each visitor based on his or her preferences,
or based on data gathered from other visitors with similar preferences. If your web site knows
how to suggest additional products to an individual visitor in a clever way, he or she might end
up buying more than initially planned. In this chapter, you’ll implement a simple but efficient
product recommendations system in your web store.
Chapter 12: Adding Customer Accounts.
So far in this book, you’ve built a basic (but functional) site and hooked it into PayPal for taking
payments and confirming orders. In this last section of the book, you’ll take things a little further.
By cutting out PayPal from the ordering process, you can gain better control and reduce overheads.
This isn’t as complicated as you might think, but you must be careful to do things right.
This chapter lays the groundwork for this task by implementing a customer account system.
Chapter 13: Advanced Customer Orders.
Your e-commerce application is shaping up nicely. You’ve added customer account functionality,
and you’re keeping track of customer addresses and credit card information, which is
stored in a secure way. However, you’re not currently using this information—you’re delegating
responsibility for this to PayPal. In this chapter, you’ll make the modifications required for
customers to place orders that are associated with their user profile.
Chapter 14: Order Pipeline.
In this and the next chapter, you’ll build your own order-processing pipeline that deals with
credit card authorization, stock-checking, shipping, sending email notifications, and so on.
We’ll leave the credit card processing specifics until Chapter 16, but we’ll show you where this
process fits in before then.
Chapter 15: Implementing the Pipeline.
Here you complete the previous chapter’s work by adding the required pipeline sections so that
you can process orders from start to finish. We’ll also look at the web administration of orders
by modifying the order administration pages added earlier in the book to take into account the
new order-processing system.
Chapter 16: Credit Card Transactions.
The last thing you need to do before launching the e-commerce site is enable credit card
processing. In this chapter, we’ll look at how you can build this into the pipeline you created in
the last chapter. You’ll learn how to process payments through DataCash and using the VeriSign
Payflow Pro service.
Chapter 17: Integrating Amazon Web Services.
In the dynamic world of the Internet, sometimes it isn’t enough to just have an important web
presence; you also need to interact with functionality provided by third parties to achieve your
goals. So far in this book, you’ve seen how to integrate external functionality to process payments
from your customers. In this chapter, you’ll learn new possibilities for integrating functionality
from an external source, this time through a web service.
Appendix A: Installing the Software.
Here you’ll learn how to set up your machine for the e-commerce site you’ll build throughout
the book. You’re shown the steps to install Visual Web Developer 2005 Express Edition, SQL
Server 2005 Express Edition, SQL Server Express Manager, and IIS 5.x.
Appendix B: Project Management Considerations.
Although the way you build your e-commerce web site throughout this book (by designing and
building one feature at a time) is ideal for learning, in real-world projects, you need to design
everything from the start, otherwise you risk ending up with a failed project. Appendix B is a
very quick introduction to the most popular project-management methodologies and gives
you a few guidelines about how to successfully manage building a real-world project.