ASP.NET 2.0 Instant Results. Wiley

Imar Spaanjaars, Paul Wilton, and Shawn Livermore

Wiley Publishing, Inc.

Copyright © 2006 by Wiley Publishing, Inc., Indianapolis, Indiana

E-book Shop
ASP.NET 2.0 Instant Results
About the Authors
Imar Spaanjaars graduated in Leisure Management from the Leisure Management School in the
Netherlands, but quickly changed his career path into the Internet world. After working for a large corporation and doing some freelance work, he is now working for Design IT, an IT company in the
Netherlands that specializes in Internet and Intranet applications built with Microsoft technologies like
ASP.NET. As a software designer and lead developer, he’s responsible for designing, building, and
implementing medium- to large-scale e-commerce web sites and portals.
Before this book on ASP.NET 2.0, Imar wrote two books about Macromedia Dreamweaver, called

Beginning Dreamweaver MX and Beginning Dreamweaver MX 2004, both published under the Wrox brand.
Imar is also one of the top contributors to the Wrox Community Forums at http://p2p.wrox.com
where he shares his knowledge with fellow programmers.
Imar lives in Utrecht, the Netherlands, together with his girlfriend Fleur. You can contact him through
his web site at http://imar.spaanjaars.com.

Paul Wilton got an initial start as a Visual Basic applications programmer at the Ministry of Defense in
the UK before finding himself pulled into the Net. Having joined an Internet development company, he
spent three years helping create Internet solutions. He’s now running his own company developing
online holiday property reservation systems.
Paul’s main skills are in developing web front ends using DHTML, JavaScript, and VBScript as well as
back-end solutions with ASP, ASP.NET, Visual Basic, and SQL Server.

Shawn Livermore (MCAD, MCSD, PMP) [shawnlivermore.blogspot.com] has been architecting and
developing Microsoft-based solutions for nearly a decade. Shawn consults as an architect for Fortune
500 clientele, leveraging time-proven methodologies and exceptional communications, within highly
visible projects. His range of technical competence stretches across platforms, but specializes within
Microsoft .NET development and server-based products such as Biztalk and SQL Server, among others.
His experience implementing enterprise-level Microsoft solutions is extensive and has led to successful
business ventures with numerous firms. Shawn lives in the Southern California area with his beautiful
wife Shantell and amazing daughter Elexzandreia.

Acknowledgments
Imar Spaanjaars
Writing a book like this one is definitely not a solo project. During development of this book I got a lot of
support from many people who helped me to stay focused and get inspiration. I would like to give all of
you that helped a big thanks! While I can’t possibly thank all of you here personally, there are a few people I’d like to thank in particular. First of all I’d like to thank the people at Wiley for working with me on this project, with Brian Herrmann in particular for his efforts during the editorial process.
I would also like to thank Anne Ward for helping me with the designs of some of the applications featured in this book. A big thanks goes out to the people at Design IT for their participation in my “hallway usability tests” that I randomly brought up in the office. Thanks guys! It’s always good to have a few extra sets of eyes. My appreciation also goes out to my two good friends René and Joost for their friendship. Looking forward to spending more time with you again. Last but certainly not least, I would like to thank my girlfriend Fleur for her support during this project. I know it wasn’t always fun when I disappeared in my home office for hours, but you were a great supporter and motivator nonetheless.
Imar Spaanjaars contributed Chapters 5, 6, and 8–12 to this book.

Paul Wilton
I’d like to say a very big thank you to Brian Herrmann, who has been a great editor to work with and
has done amazing work on the book. He manages to maintain professionalism and sense of humor even
when faced with another of my “just a few more days and I’ll get the chapter to you” e-mails!
Thanks also to Jim Minatel for making this book happen, and also his support in what has for me been a
challenging and difficult year.
Many thanks to everyone who has supported and encouraged me over the many years of writing books.
Your help will always be remembered.
Finally, pats and treats to my German Shepherd Katie, who does an excellent job warding off disturbances
from door-to-door salespeople.
Paul Wilton contributed Chapter 1 to this book.

Shawn Livermore
I thank my gorgeous wife Shantell, who is a truly beautiful and caring person, and has always encouraged
me to shoot higher. Your love has changed my life. Thanks for supporting me through the long
hours and boring computer nerd conversations. I owe you a pair of Gucci shoes. And of course, to my
daughter Elexzandreia, who is a gift from heaven. You have taught me so much about life and have
made me want to be a better dad. I love you “134,000.”
Shawn Livermore contributed the Introduction and Chapters 2–4 and 7 to this book.


Introduction

For all of the programmers out there who just love a good .NET book to get them up and running fast in
a new technology, you are in luck. ASP.NET 2.0 Instant Results is the perfect fast-track book for the programmer or architect to pick up on the new features and tools available in the 2.0 version of ASP.NET.
Sure, you could read a traditional book, and spend countless hours guessing what you really have to do
in order to get the software to work properly—or you could simply use the materials in the following
chapters to understand and test the example projects provided in a short amount of time.
Some of the compelling reasons to produce this book are tied to the incredible reviews about the 2.0 version of the .NET Framework, along with the development advancements seen within the Visual Studio 2005 environment. ASP.NET 2.0 is a hot technology, poised for rapid adoption and growth compared to the 1.1 version, thanks to some exciting features that focus on providing web developers with the tools they need for the majority of their development projects. These must-haves include the new login controls, which enable developers to quickly drag and drop a set of controls on the design surface, set a few properties, and have a near-instantaneous security system. Another new feature is the enhancements to the design-time user interfaces for binding data controls. Awizard-like aspect surrounds most of the controls, which are in fact very easy to operate. Other exciting controls exist, but they are not the end of the story. Avast amount of changes has been planted within ASP.NET 2.0, involving the architecture of sites, speed of page requests, management of stateful information, and efficiency of development overall. Sound too good to be true?
Well, if you are taking on ASP.NET 2.0, your programming effort just got a whole lot easier.

Who This Book Is For
This book is ideal for any programmer with .NET experience to learn the new technology. Anyone who
has experimented with .NET 1.1 or implemented full-scale solutions for their employers would be a perfect candidate to easily absorb all of the materials within this book. You should have some general
understanding of how a basic database works, with experience in developing software to access a
database object such as a stored procedure.

For a beginner, you may want to skip over to Chapter 7. This chapter is very lightweight in design,
aimed at providing a simplistic approach to a very common web site style. That is, the family photo
album web site. This chapter explains the basic concepts of sharing photos within a web site and adding
and deleting photos. It would be a great way to catch the basic concepts early on, before diving into
more complicated site designs and concepts within the book.

The best approach for advanced readers is to find a chapter that interests you, and skip right to it. No
ground is lost by moving through this reference book of geniuses (shameless plug). It is meant to be a
helpful guide and a reference quick-start for diving deep into working code, in an attempt to learn it
rapidly. Each chapter is almost completely self-contained and is a completely different implementation
of various overlapping features. Some chapters may repeat a concept for a redundant and thorough
learning process, whereas others may divert from the consistent features and usages in order to provide
a broad approach to the site’s unique requirements. In some cases, where you require a full explanation
of a topic that has previously been discussed, you’ll find a reference to an earlier chapter that describes
that topic in great detail.

Screenshot

E-books Shop

Purchase Now !
Just with Paypal




Product details
 Price
 File Size
 10,403 KB
 Pages
 543 p
 File Type
 PDF format
 ISBN-13
 ISBN-10
 978-0-471-74951-6
 0-471-74951-6
 Copyright
 2006 by Wiley Publishing, Inc 


Table of Contents

Acknowledgments v
Introduction xvii
Chapter 1: The Online Diary and Organizer
Using the Online Diary 1
Design of the Online Diary 6
The Data Access Layer 6
The Business Layer 8
The OnlineDiary Class 8
The Contact Class 8
The ContactCollection Class 10
The DiaryEntry Class 11
The DiaryEntryCollection Class 13
The DiaryEvent Class 14
The DiaryEventCollection Class 16
Code and Code Explanation 17
File Structure 17
Registration, Logging On, and Security 18
Logging On 18
New User Registration 19
Password Reminder 23
Viewing the Online Calendar 24
Creating, Editing, and Viewing a Diary Entry 26
Creating, Editing, and Viewing Diary Events 29
Managing Contacts 32
Setting up the Online Diary 34
Summary 35
Chapter 2: Wrox File Share
Using the Wrox File Share 38
Wrox File Share Design 41
Uploading Files 41
Sending E-Mails 42
Structure of the Site 43
Cournrteenntt sHead
Data Model and Database Objects 44
The Email Table 44
The Contact Table 44
The Resource Table 45
Themes and Skins 50
Security Model 51
Classes Involved 52
The EmailContent Class 52
The Resource Class 53
The Config Class 54
The Utilities Class 55
Code and Code Explanation 55
Root Files 56
Web.config 56
config.vb 56
Resource.vb 58
resourceDB.vb 59
WebForms 62
Default.aspx 62
Login.aspx 63
Download.aspx 64
User Controls 65
header.ascx 65
footer.ascx 66
navigation.ascx 66
Setting up the Project 67
Hosted Web Site Installation 67
Local Developer Installation 68
Summary 69
Chapter 3: Wrox Chat Server
Using the Wrox Chat Server 73
Wrox Chat Server Design 75
Sending Messages Using Callbacks 75
Structure of the Site 78
Data Model 78
The Category Table 79
The Room Table 79
The Message Table 80
The User Table 80
CurreCnotn Hteenatds
Themes and Skins 80
Classes Involved 81
The ChatRoom Class 81
The ChatRoomDB Class 82
The Config Class 83
Code and Code Explanation 84
Root Files 84
Web.config 84
Config.vb 84
ChatRoom.vb 85
ChatRoomDB.vb 86
WebForms 88
SignIn.aspx 88
Default.aspx 88
ChatRoom.aspx 90
ChatWindow.aspx 92
User Controls 94
header.ascx 95
footer.ascx 95
navigation.ascx 95
Setting up the Project 96
Hosted Web Site Installation 96
Local Developer Installation 96
Summary 97
Chapter 4: Wrox Survey Engine
Using the Wrox Survey Engine 100
Adding a New Survey 105
Editing an Existing Survey 109
Wrox Survey Engine Design 110
Object Binding and SQL Server Data Binding 110
Structure of the Site 111
Data Model and Database Objects 112
Themes and Skins 115
Security Model 116
Classes Involved 117
The SurveyBase Class 117
The Survey Class 118
The SurveyDB Class 120
The Config Class 121
Cournrteenntt sHead
Code and Code Explanation 122
Root Files 122
Web.config 122
Survey.vb 122
Config.vb 123
SurveyDB.vb 124
WebForms 126
Default.aspx 126
Login.aspx 126
TakeSurvey.aspx 126
User Controls 127
header.ascx 127
footer.ascx 128
navigation.ascx 128
surveyresults.ascx 129
currentsurvey.ascx 130
Setting up the Project 130
Hosted Web Site Installation 131
Local Developer Installation 131
Summary 132
Chapter 5: Wrox CMS
Using the Wrox CMS 133
Viewing Content on the Site 134
Managing Content with the CMS 135
Design of the Wrox CMS 136
The Business Layer 137
The Data Access Layer 139
The Data Model 139
Helper Class 140
Code and Code Explanation 141
Root Files 141
Web.config 141
SiteMaster.master and AdminMaster.master 142
Login.aspx 146
The Management Folder 146
Managing Categories 146
Managing Content 153
Displaying Content on the Web Site 159
Setting up the Wrox CMS 162
Using the Installer 162
Manual Installation 162
CurreCnotn Hteenatds
Changing IIS Settings 162
Changing Security Settings 163
Testing Out the Site 164
Summary 165
Chapter 6: Wrox Blog
Using the Blog 168
Design of the Wrox Blog 170
The Business Layer 170
The BlogEntry Class 171
The BlogManager Class 172
The UserManager Class 173
The Data Access Layer 174
The BlogManagerDB Class 176
The UserManagerDB Class 177
The Data Model 178
Stored Procedures and Queries 179
Helper Classes 180
Code and Code Explanation 181
Root Files 181
Web.config 181
Login.aspx 181
Global.asax 184
Writing Provider-Independent Code 185
The Controls Folder 188
BlogEntriesFilter.ascx 188
BlogEntries.ascx 191
Structured Error Handling and Logging 198
Configuration 198
Handling and Logging Errors 198
Setting up the Wrox Blog 200
Using the Installer 200
Manual Installation 201
Summary 203
Chapter 7: Wrox Photo Album
Using the Wrox Photo Album 206
Wrox Photo Album Design 211
How It All Fits Together 211
Storing Images 212
Displaying Images 212
Cournrteenntt sHead
Site Structure 213
Themes and Skins 214
Data Model 216
Security Model 217
Classes Involved 218
Code and Code Explanation 221
Root Files 222
Web.config 222
Masterpage.master and Admin.master 222
Web.sitemap 223
WebForms 223
Photos.aspx 223
Login.aspx 224
Admin.aspx 225
Editphotos.aspx 227
Secure Area Files 228
User Controls 229
header.ascx 229
footer.ascx 229
navigation.ascx 229
Setting up the Project 230
Hosted Web Site Installation 230
Local Developer Installation 231
Summary 232
Chapter 8: Customer Support Site
Using the Customer Support Site 233
Design of the Customer Support Site 235
The Business Layer 236
The ContentBase Class 236
The Product Class 237
The Download Class 239
The Faq Class 239
The Category Class 241
The Data Access Layer 241
The ProductDB Class 242
The DownloadDB Class 243
The FaqDB class 243
The CategoryDB class 243
The Data Model 244
Stored Procedures and User-Defined Functions 247
Helper Classes 247
The AppConfiguration Class 247
CurreCnotn Hteenatds
Code and Code Explanation 248
Root Files 248
Web.config 248
Global.asax 248
Default.aspx 248
Master Pages 249
Other Files and Folders 250
The Product Locator 251
The Downloads List 256
Searching Frequently Asked Questions 262
The Customer Support Site CMS 268
Categories.aspx 268
The List Pages 268
The Create and Update Pages 269
Setting up the Customer Support Site 269
Using the Installer 269
Manual Installation 270
Using the Customer Support Site 270
Summary 271
Chapter 9: Wrox WebShop
Using the WebShop 273
Navigating the WebShop 274
Maintaining the WebShop Product Catalog 276
Design of the WebShop 277
The Business Layer 277
Product 277
OrderedProduct 279
ShoppingCart 280
ShopManager 281
Customer 283
The Data Access Layer 284
The Data Model 284
ShopManagerDB 287
Helper Classes 288
Code and Code Explanation 289
Root Files 289
Global.asax 289
Web.config 289
MasterPage.master 291
Default.aspx 292
Login.aspx 292
UserDetails.aspx 293
Cournrteenntt sHead
The Shop Folder 293
Displaying Products 294
Adding a Product to the Cart 296
The ShoppingCart.aspx Page 297
Changing Items in the Cart 298
Finalizing Orders 301
The Management Folder 306
Setting up the WebShop 307
Using the Installer 307
Manual Installation 307
Modifying Security Settings 307
Changing E-mail Settings 309
Managing Products 309
Summary 309
Chapter 10: Appointment Booking System
Using the Appointment Booking System 311
Maintaining the Appointment Booking System 312
Making Appointments with the Appointment Booking System 314
Creating an Account 314
The Availability Checker 314
The Appointment Wizard 315
Design of the Appointment Booking System 316
The Business Layer 316
BookingObject 316
BookingObjectManager 317
Appointment 318
AppointmentManager 320
Weekdays 321
The Data Access Layer 322
BookingObjectManagerDB 322
AppointmentManagerDB 322
The Data Model 323
Helper Classes 324
AppConfiguration 324
Helpers 325
Code and Code Explanation 325
Web.config 325
Global.asax 326
Default.aspx 326
Current Head
Master Pages 326
Other Files and Folders 326
The Availability Checker 327
The Appointment Wizard 334
The Sign Up Page 340
The Management Section 342
Saving Configuration Information 342
Managing Booking Objects 344
Viewing Appointments 345
Setting up the Appointment Booking System 349
Using the Installer 349
Manual Installation 349
Configuring the Application 350
Summary 350
Chapter 11: Greeting Cards
Creating Your Own Greeting Card 352
Design of the Greeting Cards Application 355
The Toolkit 356
The Imaging Class 356
The UploadHandler Class 358
Helper Classes 361
The FileHandlingEventArgs Class 361
AppConfiguration 361
Code and Code Explanation 362
The Host Page 362
Uploading and Resizing Images 366
Uploading Files 367
Resizing Images 369
Rotating and Flipping Images 372
Cropping Images 374
Adding Text to Images 379
Sending E-Mail with Embedded Images 384
Setting up the Greeting Card Application 386
Using the Installer 387
Manual Installation 387
Configuring the Application 387
Configuring Security Settings 387
Configuring the Mail Server 389
Summary 390
Contents
Current Head
Chapter 12: The Bug Base
Using the Bug Base 392
Design of the Bug Base 396
The Business Layer 397
Bug 397
BugManager 399
BugComparer 400
CommentManager 400
ListManager 400
MemberManager 402
NameValue 402
SearchCriteria 402
The Data Access Layer 403
BugManagerDB 407
CommentManagerDB 408
ListManagerDB 409
MemberManagerDB 410
Code and Code Explanation 410
Root Files 410
Web.config 410
MasterPage.master 412
Global.asax 413
Web.sitemap 413
Filing a Bug 413
Searching and Viewing Bugs 423
Other Files and Folders 433
Setting up the Bug Base 435
Using the Installer 435
Manual Installation 435
Browsing to the Bug Base 436
Summary 436
Index 439
  ●▬▬▬▬▬❂❂❂▬▬▬▬▬●
●▬▬❂❂▬▬●
●▬❂▬●

═════ ═════

Previous Post Next Post