
Beginning ASP.NET 2
.0.pdf






13
E-Commerce
This is the first version of this book that’s ever dared to talk about e-commerce. This isn’t because we’ve forgotten to, or because we think it’s unimportant, but mainly because this is the first version of ASP.NET where it hasn’t been too complicated to even think about. I must admit it’s the one area as a developer that even I (or any developer) will tread carefully. The reason is simple — money. When you’re handling other people’s money, you really must make every effort to ensure that nothing can go wrong. If not, you, or the company you work for, could be held responsible and personally liable for every penny lost or stolen.
If you’re not frightened off by that rather stern introduction, then I must hasten to add that there has never been a better time for building e-commerce functionality into your applications. By e-commerce I’m using an all-embracing term, because e-commerce covers a multitude of features; in fact, it extends over the entire process of buying and selling an item on the Web. If you consider what happens when you visit a site such as Amazon, with an intention to purchase something, there are several stages. First is the product catalog that displays the list of items from which you want to make a purchase. Once you’ve chosen an item, it is moved into your shopping cart. You can choose to continue shopping and add more items, and once you’ve finished, you check out. After you check out, your order has to be processed. These kinds of questions have to be answered when order processing: Is your item in stock? How long will it take to order if it isn’t? Where should it be delivered? Next comes the bit we all hate, getting the credit card out and supplying details, checking that the number is valid, and the dates. The whole transaction should be secure. Then at last a summary and maybe an e-mail summarizing the details of the sale. ASP.NET 2.0 introduces a terrific range of features to help you build a workable e-commerce solution for any web site.
Of course it isn’t possible to fully model every step of this process in just one chapter, and as with web services entire books are devoted to this subject. Also, it just isn’t practical to set up a credit card–handling facility for the sake of testing one chapter. However, with the new features that ASP.NET 2.0 brings you can create a product catalog, a shopping cart, and a checkout system, you can update the stock details and product catalog, get users to enter their details, and see how you would handle real credit card details. This should give you a strong overview of how you can add the capability to buy and sell items from your web site, and although it is something to be wary of


