4 Login   4 Register Account    

 
 

 
 

 
 
 

 
 
 
 

 
 




Marco's Books

All the books by Marco Bellinaso


 Printer friendly version

ASP.NET 2.0 Website Programming

Problem - Design - Solution

Marco Bellinaso - Wrox Press, 2006

Pages: 600
ISBN: 0764584642
List Price: $39.99
Buy the book an Amazon for just $25.19 - you save $14.80 (37%)

On this page

download the book's source code

Book description

ASP.NET 2.0 Programming: Problem Design Solution is aimed at describing, designing, and implementing a site much like the ones you’re probably working on or will be soon, while taking the opportunity to introduce and explain many of the new features that the new great ASP.NET 2.0 framework offers. Difficult problems are addressed head-on so you'll be ready for most of the problems you’ll typically face when writing a modern website, and have one or more solutions ready for them.

Unlike many other ASP.NET books that show examples for individual pages or features, the example in this book is an integrated end-to-end site (written in C#). The entire book and site has been written specifically for ASP.NET 2.0, to use the ASP.NET 2.0 features wherever they make sense.

The end-result is a website which features a layout with user-selectable themes, a membership system, a content management system for publishing and syndicating articles and photos, polls, mailing lists, forums, an e-commerce store with support for real-time credit card processing, homepage personalization, and localization. The book leads the reader through development of a site with:

  • Account registration, personalization and theming
  • News and events, organized into categories
  • Opinion polls
  • Newsletter
  • Forums
  • E-commerce store with shopping cart and order management
  • Localization
Administration of a site will be covered including:
  • Full online back-end administrative section, to manage practically all data from an intuitive user interface
  • Site deployment
In building these site features, you'll learn these new ASP.NET 2.0 features:
  • Master pages
  • Theming
  • Personalization & Web parts
  • Membership & Profile modules
  • Personalization
  • The new server-side UI controls such as GridView, DetailsView, FormView, Wizard, MultiView, the new xxxDataSource and navigation controls, among others.
  • The new compilation mode and deployment modes
  • The new framework for instrumenting the site, as well as handling & logging exceptions
  • The new ADO.NET 2.0 features (e.g. caching with database dependency)
  • The new classes for easy distributed transactions Management
Click here to browse online the sample TheBeerHouse website!

Foreword by Francesco Balena (Microsoft RD, MS Press author, and .Net2TheMax's founder)

The opportunity of writing a foreword is always a great honor, but if the author is someone I have worked elbow-to-elbow with, then it’s more than an honor: it’s a great pleasure!

I am sure you readers are eager to read the real stuff in following chapters and aren’t very interested in when and how I met Marco a few years ago, but I believe this story is worth telling.

In late ‘90s I started www.vb2themax.com, a Web site that become quickly popular among VB6 aficionados. After a few months Marco began to email me his articles, and it was soon clear to me that I had to do with a smart developer who also had the rare gift of being able to put his experience down in words.

After a couple of years, I decided to write a commercial VB6 add-in and asked Marco to give me a hand. Marco accepted and in a few months we could launch VBMaximizer, a product which was later voted among the best productivity tools by the readers of Visual Basic Programmer’s Journal (now Visual Studio Magazine). The noteworthy detail of this story is that Marco and I worked on this project exclusively via email, without even talking to each other on the phone. I never needed to explain him what I needed and, unbelievably, the code I got from him was virtually defect-free at the first attempt! At the time I didn’t know that Marco was only about 20, otherwise I would have been far more impressed!

I physically met Marco only a few years later and since then we have worked together on many other software projects. Nevertheless, I continue to be pleasingly surprised by the professionalism he puts in everything he does, be it a program, a conference session, an article, or an entire book. Marco is among the few people I know who doesn’t really care for how long it takes to complete a task, provided that the result is something he can be proud of. And the book you’re reading is surely something he can be proud of!

As the author explains in his own introduction, this book is different from most others you can find in bookstores. Most offerings in this area are mainly reference books that dissect every little detail of version 2.0 of ASP.NET or the .NET Framework and that – in the best cases – provide a short listing to illustrate each feature. (I should be familiar with these books very well, having written many reference books myself…)

Marco’s book has a radically different approach: he explains how you can assemble all ASP.NET 2.0’s features and leverage its power to design, develop, and deploy a full-featured Web site. Don’t be fooled by the TheBeerHouse being a fictitious site for a fictitious customer: if the main differences between a sample application and a real-world Web site are the performance, security, robustness, scalability, and care for details that you expect from a commercial site, then Marco’s TheBeerHouse is more real-world than most real-world sites I have seen recently.

In fact, unlike most real site authors, Marco was able to take all the time he needed to implement an impressive list of features and fix all the bugs he bumped into. And unlike most sample application authors, he never took a shortcut and never ignored the problems that developers have to solve every day in the real world. The chapter on the articles/news management and the one on e-commerce took him longer than any other portion of the book. For sure, the overall quality exceeds what you might expect from a mere “book sample” and, as of this writing, it’s the best demonstration of ASP.NET 2.0’s new features, including Microsoft’s own starter kits.

From a teaching perspective, the great value of this book is the rationale underlying all the design and implementation decisions taken in the development phase. Marco does more than just describing what he did: he lists the pros and cons of all the alternatives he tried out and explains how he found the perfect solution (or the best compromise) to each problem. It’s like having an expert sitting besides you, able to read your mind, and ready to fix your mistakes before you have a chance to make them. Can you ask for more?

-- Francesco Balena

An excerpt from the author's introduction

Dear reader, thanks for picking up this book, and welcome to the new edition of "ASP.NET Website Programming", fully updated to ASP.NET version 2.0! The idea for this book was born in 2001, with ASP.NET 1.0, from the desire of having a book that teaches how to create real-world websites. The first edition was published in 2002, and fortunately it was a success. I want to believe that this was due to the fact that most ASP.NET books on the market were (and still are) reference-type books, that describe every single control of the framework, and all their methods and properties, but the examples they provide are single-page demos of using a control of a feature. However, typically these references don’t show how to integrate all ASP.NET features and controls into a single site with rich functionalities, which is what readers have to do at work. Designing and implementing a real-world site is different than putting up simple examples, and that’s why we think a book like this is helpful for developers facing real problems in their everyday work.

This new edition of the book was re-written completely from scratch, to use all the new features of ASP.NET 2.0 as much as possible, and is hopefully better in a number of ways: the project developed is much more complete (there’s an e-commerce module, for example) and professional, and each chapter provides enough background information on ASP.NET 2.0 to comfortably read the chapter even if you haven’t already had experiences with ASP.NET 2.0 (this is something the first edition didn’t really have).

First of all, this book is aimed at describing, designing, and implementing a site much like the ones you’re probably working on or will be soon, while taking the opportunity to introduce and explain many of the new features that the new great ASP.NET 2.0 framework offers. I don’t hide difficult problems so that the solution can be simpler and shorter to develop; rather, I try to explaini most of the problems you’ll typically face when writing a modern website, and give one or more solutions for them. The end-result is a website which features a layout with user-selectable themes, a membership system, a content management system for publishing and syndicating articles and photos, polls, mailing lists, forums, an e-commerce store with support for real-time credit card processing, homepage personalization, and localization (refer to Chapter 1 for a more detailed list of features to be implemented). I hope you enjoy reading this book, and that it offers good guidance that speeds up the development of your next project and makes it more solid, extendable, and well organized.

An excerpt from Chapter 1, that provides a more detailed description of the rest of the book

The Solution section of each chapter will contain the instructions and actual code for implementing all the features and requirements outlined and designed in the previous sections. For this first chapter, however, I’ll give you a more detailed description of exactly what the following chapters will cover, so that you can get a good idea of what the final result will be like.

In Chapter 2 you’ll build the site’s design, the graphics, and the layout that’s shared among all pages of the site, through the use of master pages, new in ASP.NET 2.0. You will also use themes—another new feature introduced by ASP.NET 2.0—to create a couple of different visual appearances for the same master page, and create a mechanism to enable users to select their own favorite theme from a drop-down list, so that they can change the colors and overall appearance of the site according to their taste and possible visual impediments. Finally, a flexible and easy to maintain navigation system will be built by means of the new Web.sitemap file and the Menu and SiteMapPath controls.

In Chapter 3 you’ll lay down the foundations for building a flexible, easily configurable, and instrumented site. First of all, there will be a pluggable data access layer (DAL) that can support any type of data store, and scalable to offer the best performance even under high usage. Then a business logic layer will be built on the top of the DAL to expose the data in an object-oriented way, with the required validation logic, transaction management, event logging, and caching. Finally, you’ll look at the UI and presentation layer, which takes advantage of the new GridView, DetailsView, and FormView controls and the companion ObjectDataSource to quickly generate complex and feature-rich, data-driven pages.

In Chapter 4 you’ll integrate ASP.NET 2.0’s new membership infrastructure into the site, to create user registration forms and supporting logic to authenticate/authorize users. You’ll also discover the new Profile module, which allows you to declaratively define user-level properties that are automatically persisted to a durable medium, quite different from the well-known traditional Session state variables that only last as long as the user browses the site on one occasion. A complete management console will be built to enable administrators to see the list of members, disable members that behave badly on the site, and view and edit each user’s profile.

In Chapter 5 you’ll build a sort of Content Management System, a module that enables administrators to completely manage the site’s articles from an intuitive UI, accessible also by nontechnical users. The module will integrate with the built-in membership system to secure the module and track the authors of the articles, and will have a syndication service that publishes an RSS feed of recent content for a specific category, or for every category, and will support ratings and comments, among many other features. The result will be quite powerful, enabling the editor to prepare richly formatted content in advance, and schedule it for automatic publication and retirement, so that the site’s content updates are as simple as possible, and require the least effort and time. At the end of the chapter, you will have experienced almost everything you can do with the new GridView, DetailsView, and ObjectDataSource controls, which is used to bind the UI to data coming from real object-oriented business classes, which themselves obtain data from a data access layer.

In Chapter 6 you’ll implement a solution for creating and managing multiple dynamic polls on the web site. It will feature an administration console for managing the polls through a web browser, a user control that enables you to plug different polls into any page you want with just a couple of lines of code, as well as a history page for viewing archived polls.

In Chapter 7 the site will be enriched with a complete module for sending out newsletters to members who registered for them in their profile page. The module will enable you to send out the e-mail newsletters from a background thread, instead of the main thread that processes the page request, so that the page won’t risk timeouts, and more important, so that the editor will not be left with a blank page for minutes at a time. AJAX (Asynchronous JavaScript and XML Programming) will be used to implement partial-page updates that provide real-time feedback about the newsletter being sent in the background. Finally, end users will be able to look at past newsletters listed on an archive page. To implement all this, you’ll use advanced features such as multi-threaded programming, the new script callback feature, and new classes for sending e-mails.

In Chapter 8 you’ll create a forums system from scratch, which supports multiple subforums with optional moderation, lists threads and replies through custom pagination and with different sorting options, has wide support for standard RSS feeds, configurable user rating, signatures and quoting, and other features typical of most recent forum software. Complete administration features (deleting, editing, approving, moving, and closing threads and posts) will also be provided.

In Chapter 9 you’ll add a working e-commerce store with most of the essential features, including a complete catalog and order management system, a persistent shopping cart, integrated online payment via credit cards, product ratings, product stock availability, rich formatting of a product’s descriptions, including text and images, configurable shipping methods and order statuses, and much more. All this will be implemented in relatively few pages, since it will leverage the good foundations built in previous chapters, and of course the ASP.NET 2.0 built-in membership and profile systems, and other new features and controls, such as the ubiquitous GridView, DetailsView, and ObjectDataSource, plus the Wizard and MultiView controls.

In Chapter 10 you’ll explore the Web Part Framework, one of the coolest and most striking new features of ASP.NET 2.0, and use it to easily add support for home page personalization. You’ll promote some user controls developed earlier in the book into Web Parts, which are boxes of content that can be dragged around the page by the user, and whose properties can be customized at runtime by means of a simple and dynamically built UI, and which can be added and removed to/from pages according to the user’s interests and preferences. You’ll be impressed by the small amount of code needed to achieve a result that only advanced sites and portal framework (such as Windows SharePoint Services) have typically offered in the past.

In Chapter 11 you’ll make the site’s home page fully localizable to an additional language, and will support the user’s preferred locale settings when displaying dates and numbers. All this can now be done easily with ASP.NET 2.0, thanks to its automatic resource generation, implicit and explicit localization expressions, strongly typed and dynamically compiled global resources, and good Visual Studio designer support.

Finally, in Chapter 12 you’ll look the different ways to deploy an ASP.NET 2.0 site, either on a local IIS server or to a remote production site, or to an inexpensive shared hosting server. The new ASP.NET compilation model enables you do use a simple XCOPY deployment that includes everything, but lacks protection of source code, and takes a little time to compile on first requests. If that’s a problem for you, you will see how you can use the new command-line tools and Visual Studio’s wizards to pre-compile the site and generate one or more compiled assemblies to deploy. You’ll also learn how to deploy the local SQL Server Express database to a remote full-featured SQL Server 2005 instance, and how you can create installer packages for distributing the application to automate as many installation tasks as possible.

 

It takes less than one minute to subscribe to our newsletter. You will receive additional material right in your mailbox. Best of all, it’s free!