Table Of ContentReal-World ASP.NET:
Building a Content
Management System
STEPHEN R. G. FRASER
APress Media, LLC
Real-World ASP.NET: Building a Content Management System
Copyright© 2002 by Stephen R. G. Fraser
Originally published by Apress in 2002
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any
means, electronic or mechanical, including photocopying, recording, or by any information
storage or retrieval system, without the prior written permission of the copyright owner and the
publisher.
ISBN 978-1-59059-024-9 ISBN 978-1-4302-0832-7 (eBook)
DOI 10.1007/978-1-4302-0832-7
Trademarked names may appear in this book. Rather than use a trademark symbol with every
occurrence of a trademarked name, we use the names only in an editorial fashion and to the
benefit of the trademark owner, with no intention of infringement of the trademark.
Editorial Directors: Dan Appleman, Peter Blackburn, Gary Cornell, Iason Gilmore, Karen
Watterson, John Zukowski
Managing Editor: Grace Wong
Copy Editor: Nicole LeClerc
Production Editor: JanetVail
Compositor: Impressions
Artist: Kurt Krames
Indexer: Rebecca Plunkett
Cover Designer: Tom Debolski
Marketing Manager: Stephanie Rodriguez
For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219,
Berkeley, CA 94710.
E-mail info@apress. corn, or visit http: 1/ www. apress. corn.
The information in this book is distributed on an "as is" hasis, without warranty. Although every
precaution has been taken in the preparation of this work, neither the author nor Apress shall
have any liability to any person or entity with respect to any loss or damage caused or alleged to
be caused directly or indirectly by the information contained in this work.
To my energy, Sarah, and bundle ofjoy, Shaina, with love.
Contents at a Glance
About the Author ................................................... .x iii
Introduction ..........................................................x v
Chapter 1 So, What Is a Content Management System Anyway? 1
Chapter 2 Version Control • • • • • 2 9
Chapter 3 Workflow .41
Chapter 4 Personalization • • • • • • • • 57
Chapter 5 Basics of Web Architecture • • 77
Chapter 6 ASP.NET, C#, and Visual Studio .NET . . 99
Chapter 7 Database Development and ADO.NET . .133
Chapter 8 XML . . . . . • . . . . . . . .185
Chapter 9 A Quick Overview of CMS.NET . . 229
Chapter 10 Initializing CMS.NET • • 267
Chapter 11 Getting Content into the System • . 299
Chapter 12 Cookies, Authentication, Authorization,
and Encryption . • . . • . -345
Chapter 13 Displaying Dynamic Content .387
Chapter 14 Using a Workflow to Enter Content • .427
Chapter 15 Registered Users and Protected Content -473
v
Contents
About the Author ................................................x iii
Introduction .......................................................x v
Chapter 1 So, What Is a Content Management
System Anyway? ...................................................
1
What Is Content? .....................................................1
Real-World Content ...................................................3
What Is a Content Component? .......................................5
The CMS Elements .....................................................6
What Is a Content Management System? ............................ 18
Some Common CMS Features ...........................................1 9
What Are the Benefits of a CMS? ..................................2 4
When Do You Need a Commercial CMS? ...............................2 7
Summary ...............................................................2 8
Chapter 2 Version Control .................................2 9
What Is Version Control? ...........................................2 9
What Is Version Tracking? .........................................3 2
What Is Rollback? ...................................................3 3
The Roles of Version Control in a CMS ............................3 4
Benefits of Version Control and Tracking ........................3 7
Summary ...............................................................3 9
Chapter 3 Workflow ..........................................
.41
What Is a Workflow? ............................................... .42
Workflow Components ............................................... .43
What Is a Workflow's Role in CMS? ................................5 0
Building CMS Workflows .............................................5 3
Benefits of a Workflow .............................................5 5
Summary ...............................................................5 6
vii
Contents
Chapter 4 Personalization .................................
57
What Is Personalization? ...........................................5 7
Personalization Objectives ........................................5 9
Types of Personalization ...........................................6 3
Law of Diminishing Returns ........................................6 8
Privacy ............................................................... 70
Role of Personalization in a CMS ................................. 71
Benefits of Personalization .......................................7 4
Summary ............................................................... 76
Chapter 5 Basics of Web Architecture .................
77
Basic Web Architecture ............................................. 78
What Are Clients and Servers, Web Style? ........................ 82
Web Programming before • NET .......................................8 7
Web Programming Using • NET ........................................9 5
Summary ...............................................................9 8
Chapter 6 ASP. NET, C#, and Visual Studio . NET ....9 9
The Simple Dynamic Content Viewer ................................ 99
Summary ..............................................................1 31
Chapter 7 Database Development and ADO. NET .......
133
Visual Studio .NET's Database Utilities ........................1 33
What Is ADO.NET? ...................................................1 46
Examples of ADO.NET Development .................................1 52
Summary ..............................................................1 83
Chapter 8 XML .................................................
185
What Is XML? ........................................................1 85
Where Is XML Used in Web Architecture? .........................1 88
XmlReader, XmlWri ter, and XPathNavigator .......................1 90
XML Examples ........................................................1 92
Summary ..............................................................2 27
viii
Contents
Chapter 9 A Quick Overview of CMS.NET ...............
229
What Is CMS. NET? ...................................................2 30
Installing CMS. NET .................................................2 30
A Brief Tutorial ...................................................2 47
Summary ..............................................................2 66
Chapter 10 Initializing CMS. NET .......................2 67
To Set Up or Not to Set Up? ......................................2 68
First, Describe the Process ......................................2 71
Using web.config to Save the Database
Connection String ..............................................2 73
Setting Up the All-Powerful Administrator .....................2 82
Database Helper Classes and Stored Procedures .................2 86
Finally, Wrap Up the Installation .............................. .295
Summary ..............................................................2 98
Chapter 11 Getting Content into the System .......2 99
Breaking a Page into Frames ......................................2 99
The XML-Driven NavBar .............................................3 03
First CMS. NET Administration Page ...............................3 05
Content Database Table ............................................3 06
Listing Site Content ..............................................3 07
Creating New Content ..............................................3 14
Error Handling .....................................................3 19
Updating Content ...................................................3 22
Viewing a Piece of Content .......................................3 31
Removing Content ...................................................3 37
Submitting Content .................................................3 40
Summary ..............................................................3 43
Chapter 12 Cookies, Authentication, Authorization,
and Encryption .................................................
345
ASP.NET Web Application Security ................................3 46
CMS. NET Security Structure .......................................3 46
Cookies and Session Objects ......................................3 48
ix
Contents
Authentication .....................................................3 51
Authorization .......................................................3 60
Encryption ..........................................................3 69
Restricting the CMA ................................................3 74
NavBar Update for Handling Roles ................................3 74
Account Maintenance ...............................................3 76
Summary ..............................................................3 86
Chapter 13 Displaying Dynamic Content ................3 87
What Is Dynamic Content? ........................................ .3 87
Three-Level Content Navigation ..................................3 88
Starting and Stopping the Web Site ..............................3 91
Navigational Database Tables .....................................3 98
User Controls .......................................................4 01
Standard CMS. NET User Controls ................................. .402
The Default Home Page Web Form ................................. .406
The HeadlineTeaser User Control ................................ .411
The Default Content-Domain Web Form ........................... .4 14
The Default Zone Web Form ....................................... .418
The Default Story Web Form ...................................... .421
Deploying Content ................................................. .424
Summary ..............................................................4 25
Chapter 14 Using a Workflow to Enter Content ..... .427
CMS. NET Content Workflow ........................................ .428
CMS.NET Roles .......................................................4 29
Interrole Communication .......................................... .432
The Authoring Phase .............................................. .439
The Editing Phase ................................................. .447
The Approval Phase ................................................ .458
The Deployment Phase ............................................. .462
Summary ..............................................................4 71
X
Contents
Chapter 15 Registered Users
and Protected Content ......................................
.473
Why Protect Content? ............................................. .474
Privacy Policy .....................................................4 74
What Are User Profiles? .......................................... .476
Methods of Gathering User Information ......................... .477
Registration Using the Slow Retrieval Method ................. .478
Logging into a Restricted Area ................................. .481
Logging Off .........................................................4 91
Restricting Content to Registered Users ....................... .492
Summary ..............................................................5 04
xi