Introduction

Dear reader, thanks for picking up this book, and welcome to the ASP.NET 3.5 Website Programming: Problem–Design–Solution, fully updated to ASP.NET version 3.5! The idea for this book was born in 2001, with ASP.NET 1.0, from the desire to have a book that teaches how to create real-world web sites. The first edition was published in 2002, and fortunately it was a success. I believe that this was due to the fact that most ASP.NET books on the market were (and still are) reference-type books, which describe every single control of the framework, and all their methods and properties, but the examples they provide are single-page demos showing how to use a control of a feature. Typically these references don't show how to integrate all ASP.NET features and controls into a single site with rich functionality, which is what readers have to do at work. Designing and implementing a real-world site is very different from creating simple examples, and that's why I think a book like this is helpful for developers facing real problems in their everyday work.

Much of this new edition was rewritten completely from scratch, while trying to preserve as much of the existing application integrity as possible. As a new author for this book I tried to find a balance between the existing Beer House application framework, add some new modules, and integrate some of the great new technologies in ASP.NET 3.5 SP1.

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 3.5 Framework offers. I don't hide difficult problems so that the solution can be simpler and shorter to develop; rather, I try to explain most of the problems you'll typically face when writing a modern web site, and provide one or more solutions for them. The result is a web site that features a layout with user-selectable themes, a membership system, a content management system for publishing and syndicating articles, photos, polls, mailing lists, forums, photo gallery, calendar of events, an e-commerce store with support for real-time credit card processing, home page personalization, search engine optimization and localization (refer to Chapter 1 for a more detailed list of features to be implemented). I also decided to write the book in VB.NET, which differs from the previous editions, but source code is available in both C# and VB.NET. I hope you enjoy reading this book, and that it offers guidance that speeds up the development of your next project and makes it more solid, extensible, and well organized.

Note

You can browse the web site online at www.thebeerhousebook.com.

The author's blog is available at http://professionalaspnet.com. Please keep an eye on it to read about further development and expansion of the sample project.

Who This Book Is For

Let me state up front that this isn't a book for completely novice programmers, or for experienced developers who have never touched ASP.NET and the .NET Framework in general. This book teaches how to write a real-world web site from scratch to deployment, and as such it can't explain every single detail of the technology, but must concentrate on designing and writing actual solutions. To get the most from this book, you should already have had some experience with ASP.NET 2.0, even if not advanced solutions. You're not required to know ASP.NET 3.5, as each chapter will introduce the new controls and features that you'll use in that chapter, providing enough background information to implement the solution. If you then want to learn more about a control, you can check the MSDN official documentation or another reference-type book such as Wrox's Professional ASP.NET 3.5. A good reference on search engine optimization principles is Wiley's Search Engine Optimization: Your Visual Blueprint for Effective Internet Marketing by Kristopher Jones. I also found Wrox's Professional LINQ by Scott Klein very helpful.

What This Book Covers

This book is basically a large case study that starts from the foundation and works its way through to completion with a series of designs and solutions for each incremental step along the way. What sets the Problem–Design–Solution series apart from other Wrox series is the structure of the book and the start-to-finish approach to one completed project. Specifically, this book leads the reader through the development of a complete ASP.NET 3.5 web site that has most of the features users expect to find in a modern content-related and e-commerce site:

  • Account registration, personalization, and themes

  • Site Navigation

  • News and events, organized into categories

  • Opinion polls

  • Newsletter

  • Forums

  • Photo Gallery

  • Calendar of Events

  • E-commerce store with shopping cart and order management

  • Localization

From an administrative point of view, the following features and problems are also covered:

  • Full online back-end administrative section, to manage practically all data from an intuitive user interface

  • Site deployment

The implementation of each of these features provides the opportunity to teach various new features introduced by ASP.NET 3.5, such as the following:

  • ASP.NET AJAX

  • The new ListView

  • Entity Framework and LINQ to Entities

Because the book is meant to be a case study of a real-world site, it does not stop at just implementing ASP.NET features; it applies them to typical scenarios. Included are:

  • Search engine optimization techniques

  • Error logging and handling

  • CSS layouts

Not only does this book cover the new features of ASP.NET 3.5, it also demonstrates how to integrate all of them together, for the development of a single full-featured site. All the design options are explained and discussed (including the database design, the data access and business logic components design, and the overall site architecture); at the end of the book you will have learned many of the best practices for web development, based on a solid, scalable, and extensible architecture.

How This Book Is Structured

The book builds a complete project from start to finish. All the chapters (other than the first one) are self-contained modules within the larger project, and are structured in three sections:

  • Problem: This defines the problem or problems to be addressed in the chapter: What do you want to do in this chapter? What features do you want to add to the site and why are they important? What restrictions or other factors need to be taken into account?

  • Design: After the problem is defined adequately, this section describes what features are needed to solve the problem. This will give you a broad idea of how the solution will work or what will be entailed in solving the problem.

  • Solution: After setting up what you are going to accomplish and why (and how that solves the problem defined earlier), we will produce and discuss the code and any other material that will realize the design and solve the problem laid out at the beginning of the chapter. Just as the coverage of the book as a whole is weighted toward solution, so is each chapter. This is where you will get hands-on practice and create the code.

The book is intended to be read from cover to cover, so that you start with nothing and finish with a complete and deployed web site ready to be launched. However, the book follows a modular structure, so every chapter is quite self-contained and implements a module that, if necessary, can be taken out of the proposed sample project and re-used in some other web site.

What You Need to Use This Book

To follow the book by building the project on your own computer, or to run the downloadable and ready-to-use project, you'll need the following:

  • Windows XP Professional, Windows Vista, Windows 7, Windows Server 2008, Windows Server 2003, or Windows 2000 Professional or Server.

  • Any edition of Visual Studio 2008, including the freely available Visual Web Developer 2008 Expression Edition. However, Visual Studio 2008 Standard is suggested. You'll be able to follow the book, and run the sample project, even if you don't use a Microsoft editor at all (if, for example, you prefer using Macromedia Dreamweaver MX or some other text editor), because Visual Studio's designers are described and demonstrated in the "Design" section of some chapters, but are not used to write the code in the "Solution" section.

  • The freely available SQL Server 2008 Express Edition, and possibly SQL Server 2008 Standard Edition.

Conventions

To help you get the most from the text and keep track of what's happening, we've used a number of conventions throughout the book.

Note

Boxes like this one hold important, not-to-be forgotten information that is directly relevant to the surrounding text.

Notes, tips, hints, tricks, and asides to the current discussion are offset and placed in italics like this.

As for styles in the text:

  • New terms and important words are highlighted when introduced.

  • Keyboard combination strokes look like this: Ctrl+A.

  • File names, URLs, and code within the text look like so: persistence.properties.

  • Code is presented in two different ways:

    We use a monofont type with no highlighting for most code examples.
    We use gray highlighting to emphasize code that is of particular importance in
    the present context, or to indicate where new code is added.

Source Code

As you work through the examples in this book, you may choose either to type in all the code manually or to use the source code files that accompany the book. All of the source code used in this book is available for download at http://thebeerhouse.codeplex.com/. Once at the site, you can either download the current source code by selecting the files under 2.0 Production – WebForms. This site is shared with the MVC edition as well, so be aware of that. You can also download the source code by selecting the Source Code tab and following the instructions on the page.

If for any reason the source is not available at CodePlex, we will keep a copy available for download at www.wrox.com. Once at the site, simply locate the book's title (either by using the Search box or by using one of the title lists) and click the Download Code link on the book's detail page to obtain all the source code for the book.

Because many books have similar titles, you may find it easiest to search by ISBN; this book's ISBN is 978-0-470-18758-6.

Once you download the code, just decompress it with your favorite compression tool. Alternately, you can go to the main Wrox code download page at http://www.wrox.com/dynamic/books/download.aspx to see the code available for this book and all other Wrox books.

Errata

We make every effort to ensure that there are no errors in the text or in the code. However, no one is perfect, and mistakes do occur. If you find an error in one of our books, like a spelling mistake or faulty piece of code, we would be very grateful for your feedback. By sending in errata you may save another reader hours of frustration and at the same time you will be helping us provide even higher quality information.

To find the errata page for this book, go to www.wrox.com and locate the title using the Search box or one of the title lists. Then, on the book details page, click the Book Errata link. On this page you can view all errata that has been submitted for this book and posted by Wrox editors. A complete book list including links to each book's errata is also available at www.wrox.com/misc-pages/booklist.shtml.

If you don't spot "your" error on the Book Errata page, go to www.wrox.com/contact/techsupport.shtml and complete the form there to send us the error you have found. We'll check the information and, if appropriate, post a message to the book's errata page and fix the problem in subsequent editions of the book.

p2p.wrox.com

For author and peer discussion, join the P2P forums at p2p.wrox.com. The forums are a Web-based system for you to post messages relating to Wrox books and related technologies and interact with other readers and technology users. The forums offer a subscription feature to e-mail you topics of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are present on these forums.

At http://p2p.wrox.com you will find a number of different forums that will help you not only as you read this book, but also as you develop your own applications. To join the forums, just follow these steps:

  1. Go to p2p.wrox.com and click the Register link.

  2. Read the terms of use and click Agree.

  3. Complete the required information to join as well as any optional information you wish to provide and click Submit.

  4. You will receive an e-mail with information describing how to verify your account and complete the joining process.

You can read messages in the forums without joining P2P but in order to post your own messages, you must join.

Once you join, you can post new messages and respond to messages other users post. You can read messages at any time on the Web. If you would like to have new messages from a particular forum e-mailed to you, click the Subscribe to this Forum icon by the forum name in the forum listing.

For more information about how to use the Wrox P2P, be sure to read the P2P FAQs for answers to questions about how the forum software works as well as many common questions specific to P2P and Wrox books. To read the FAQs, click the FAQ link on any P2P page.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset