Search and Find
Service
More of the content
Pro ASP.NET 4 CMS - Advanced Techniques for C# Developers Using the .NET 4 Framework
Title Page
1
Copyright Page
2
Contents at a Glance
4
Table of Contents
5
About the Author
12
About the Technical Reviewer
13
Acknowledgments
14
Introduction
15
About This Book
15
What You Need to Use This Book
16
Code Samples
16
Feedback
16
CHAPTER 1 Visual Studio 2010 and .NET 4
17
Who This Book Is For
17
Who This Book Is Not For (or “Buy Me Now, Read Me Later”)
18
What’s New in .NET 4
18
C# Optional and Named Parameters
19
C#’s dynamic Keyword
21
Dynamic and Functional Language Support
26
Parallel Processing
26
Parallel LINQ (PLINQ)
27
Task Parallel Library (TPL)
27
Axum
28
Managed Extensibility Framework (MEF)
29
Distributed Caching with Velocity
29
ASP.NET MVC
32
A Tour of Visual Studio 2010
34
Windows Presentation Foundation
34
Historical Debugging
35
Improved JavaScript IntelliSense
37
jQuery Support
38
Building a CMS
40
CMS Functional Requirements
40
Creating the Application Framework
41
Summary
44
CHAPTER 2 CMS Architecture and Development
45
Motivations for Building a CMS
45
Motivations for Using .NET
46
Application Architecture
46
The CMS Application Tiers
48
CommonLibrary: The Data Transfer Objects
49
GlobalModule: The HttpModule
51
Components of a CMS Page
53
Buckets
53
Embeddable Objects
55
Embeddable Permissions
57
Handling CMS Content
59
The Content Table
59
The ContentVersion Table
60
Assembling Content on Demand
60
How Embeddable Objects Handle Versions
62
Summary
62
CHAPTER 3 Parallelization
63
What Is Parallelization?
63
Good Parallelization Candidates
63
Differences from Multithreading
64
Parallel Pitfalls
64
Deadlocks
64
Race Conditions
67
Thread Starvation
70
Amdahl’s Law
71
.NET 4 Parallelization Concepts
72
Task vs. Data Parallelism
72
Task Parallel Library
72
Task.Wait()
73
Parallel.For() and Parallel.ForEach()
75
Parallel LINQ (aka PLINQ)
75
.AsParallel()
76
CMS Parallelization Opportunities
77
Creating a Data Mining Embeddable
78
Expanding the Data Mining Tasks
82
Tagging
86
Tagging on the Client
89
Fleshing Out the Tagging Embeddable
91
What’s in a Name?
92
Handling Tag Input
95
Tag Processing in the Business Tier
98
POST Problems
103
Finalizing Tag Storage
105
Content Tags
112
Summary
118
CHAPTER 4 Managed Extensibility Framework and the Dynamic Language Runtime
119
Managed Extensibility Framework
119
The Manual Way
119
The MEF Way
121
Working from Usage to Implementation
122
Exposing Libraries via MEF
122
A Simple Plug-in Contract
123
Implementing the Plug-In
123
Using the Plug-In
124
Catalogs and Containers
128
Supporting Multiple Parts
129
Dynamic Language Runtime
133
The dynamic Keyword
134
Benefits of the dynamic Keyword
135
CMS Plug-Ins
136
IEmbeddable
137
Server Controls as Embeddables
138
Displaying Embeddables
140
PageAssembler
141
Additional Methodology Benefits
144
Missing DLLs
144
Exceptions in Embeddables
145
A More Complex Emeddable
146
Breadcrumbs
146
Navigating the CMS Tree
147
Summary
149
CHAPTER 5 jQuery and Ajax in the Presentation Tier
150
An Introduction to jQuery
150
The $() Factory
151
Implicit Iteration
153
Ajax via jQuery
154
Caching and Ajax
155
Avoiding Caching on GET Requests
156
Lightweight Content Delivery with Ajax and HTTP Handlers
157
Handling Asynchronous Errors
162
Handling DOM Modifications
165
Improving the CMS Admin with jQuery
169
Creating Collapsible Panels
171
Expanding with jQuery
173
Displaying the JavaScript Disabled Message
175
Poka-Yoke Devices
176
Summary
179
CHAPTER 6 Distributed Caching via Memcached
180
What Is a Distributed Cache, and Why Is it Important?
180
Memcached
181
Acquiring a Memcached Client Library
182
Getting Started with Memcached
183
Using the Client Libraries Directly
186
Writing a Memcached Library
188
Testing the Library
191
Deleting Objects from the Cache
193
Complex Object Types
193
Protocol Considerations
196
Memcached Internals and Monitoring
198
Building a Cache-Friendly Site Tree
200
Visualizing the Tree
201
Defining a Node
201
Defining the Tree
202
Finding Nodes
203
Inserting Nodes
205
Serializing/Deserializing the Tree for Memcached Storage
206
Memcached Configuration Considerations
209
Summary
211
CHAPTER 7 Scripting via IronPython
212
How Does the CMS Benefit from Scripting Capabilities?
212
Easier Debugging
212
Rapid Prototyping
213
An Introduction to IronPython and Its Syntax
213
What Is IronPython?
213
Installing IronPython
214
The IronPython Type System
215
Creating Classes and Controlling Scope
218
Constructors as Magic Methods
221
self
222
Exception Handling
226
Conditional Logic, Iterators, and Collections
229
Accessors and Mutators
231
Assembly Compilation
232
Compiling IronPython Code to a DLL
233
Compiling IronPython Code to an Executable
234
Building Scripting Capabilities into the CMS
235
Handling Script Files Between Tiers
238
Calling Scripts for a CMS Page
239
A Simple Scripting Example
241
Summary
243
CHAPTER 8 Performance Tuning, Configuration, and Debugging
244
The CMS Definition of Performance
244
Latency
244
Throughput
245
Establishing Baselines
245
Component vs. System Baselines
245
The Web Capacity Analysis Tool
246
Installing WCAT
246
WCAT Concepts
246
Configurations
247
Scenarios
248
Running a WCAT Test Against the CMS
250
Interpreting Performance Results
251
Improving CMS Performance with Caching
252
HTTP.sys and the OutputCache
252
Benchmarking CMS Performance
253
Configuration Considerations
254
Enable Release Mode for Production
254
Removing the Server, X-Powered-By, and X-AspNet-VersionHeaders
256
Debugging Concepts
259
White-Box vs. Black-Box Debuggers
259
User Mode vs. Kernel Mode
260
Historical Debugging via IntelliTrace
261
Collaborative Debugging
265
Importing and Exporting Breakpoints
265
DataTip Pinning and Annotation
268
Summary
271
CHAPTER 9 Search Engine Optimization and Accessibility
272
An Introduction to Search Engine Optimization
272
Science or Dark Art?
273
General Guidelines
273
Establishing Clear Markup
274
HTML Metadata the .NET 4 Way
275
Graceful JavaScript Degradation
276
Providing alt Text for Images
278
Color Scheme Sensitivity
278
Friendly URLs
280
Data Requirements for Friendly URLs
280
Stored Procedures for Friendly URLs
283
Exploiting the Page Life Cycle
284
Request Exclusion
286
Retrieving Friendly URLs
288
Retrieving Alias URLs and Response.RedirectPermanent()
294
Summary
298
Index
299
All prices incl. VAT