Suchen und Finden
Title Page
1
Copyright Page
2
Contents at a Glance
4
Table of Contents
6
About the Authors
31
About the Technical Reviewer
32
Introduction
33
What Does This Book Cover?
33
Who Is This Book For?
34
What Do You Need to Use This Book?
35
Customer Support
35
Sample Code
35
Errata
35
PART I Core Concepts
36
CHAPTER 1 Introducing ASP.NET
37
The Seven Pillars of ASP.NET
37
#1: ASP.NET Is Integrated with the .NET Framework
37
#2: ASP.NET Is Compiled, Not Interpreted
38
#3: ASP.NET Is Multilanguage
40
#4: ASP.NET Is Hosted by the Common Language Runtime
42
#5: ASP.NET Is Object-Oriented
43
#6: ASP.NET Supports all Browsers
45
#7: ASP.NET Is Easy to Deploy and Configure
45
The Evolution of ASP.NET
46
ASP.NET 1.0 and 1.1
46
ASP.NET 2.0
46
ASP.NET 3.5
48
LINQ
48
ASP.NET AJAX
49
ASP.NET 4
51
ASP.NET MVC
52
ASP.NET Dynamic Data
52
Silverlight
53
Summary
53
CHAPTER 2 Visual Studio
54
Introducing Visual Studio
54
Websites and Web Projects
55
Creating a Projectless Website
56
The Development Language
57
The Framework Version
57
The Template
58
The Location
59
Designing a Web Page
61
Absolute Positioning
62
Smart Tags
63
Static HTML Tags
64
HTML Tables
64
Structuring HTML Markup
65
The Visual Studio IDE
67
Solution Explorer
69
Document Window
70
Toolbox
70
Error List and Task List
71
Server Explorer
73
The Code Editor
74
Adding Assembly References
75
IntelliSense and Outlining
78
Outlining
78
Member List
79
Error Underlining
81
Visual Studio 2010 Improvements
81
IntelliSense Gets More Intelligent
82
New Tools for Search and Navigation
83
Draggable Document Windows
85
The Code Model
85
How Code-Behind Files Are Connected to Pages
88
How Control Tags Are Connected to Page Variables
89
How Events Are Connected to Event Handlers
90
Web Projects
91
Project-Based Development
92
Creating a Web Project
93
Migrating a Website from a Previous Version of Visual Studio
94
Visual Studio Debugging
96
Single-Step Debugging
97
Variable Watches
100
Advanced Breakpoints
101
The Web Development Helper
101
Summary
103
CHAPTER 3 Web Forms
104
Page Processing
105
HTML Forms
105
Dynamic User Interface
107
The ASP.NET Event Model
108
Automatic Postbacks
109
Automatic Postbacks “Under the Hood”
109
View State
110
View State “Under the Hood”
113
View State Chunking
114
XHTML Compliance
115
Document Type Definitions
116
Configuring XHTML Rendering
117
Visual Studio’s Default Doctype
119
XHTML Validation
119
Client-Side Control IDs
121
Web Forms Processing Stages
123
Page Framework Initialization
124
User Code Initialization
125
Validation
125
Event Handling
126
Automatic Data Binding
126
Cleanup
127
A Page Flow Example
127
The Page As a Control Container
130
Showing the Control Tree
130
The Page Header
134
Dynamic Control Creation
136
The Page Class
138
Session, Application, and Cache
139
Request
139
Response
141
Moving Between Pages
143
HTML and URL Encoding
145
User
147
Trace
147
Application Tracing
151
Tracing with the Web Development Helper
153
Accessing the HTTP Context in Another Class
153
Summary
154
CHAPTER 4 Server Controls
155
Types of Server Controls
155
The Server Control Hierarchy
156
HTML Server Controls
158
The HtmlControl Class
159
The HtmlContainerControl Class
159
The HtmlInputControl Class
160
The HTML Server Control Classes
160
Setting Style Attributes and Other Properties
162
Programmatically Creating Server Controls
163
Handling Server-Side Events
165
The ServerClick and ServerChange Events
166
Web Controls
168
The WebControl Base Class
169
Basic Web Control Classes
170
Units
173
Enumerations
174
Colors
174
Fonts
175
Focus
176
The Default Button
178
Scrollable Panels
178
Handling Web Control Events
179
The Click Event and the ImageButton Control
181
The List Controls
182
The Selectable List Controls
184
The BulletedList Control
187
Input Validation Controls
189
The Validation Controls
190
The Validation Process
191
The BaseValidator Class
192
The RequiredFieldValidator Control
194
The RangeValidator Control
194
The CompareValidator Control
195
The RegularExpressionValidator Control
195
The CustomValidator Control
199
The ValidationSummary Control
200
Using the Validators Programmatically
201
Validation Groups
202
Rich Controls
204
The AdRotator Control
205
The Calendar Control
207
Summary
209
CHAPTER 5 ASP.NET Applications
210
Anatomy of an ASP.NET Application
210
The Application Domain
210
Application Lifetime
212
Application Updates
212
Application Directory Structure
213
The global.asax Application File
214
Application Events
216
Demonstrating Application Events
218
ASP.NET Configuration
219
The machine.config File
220
220
The web.config File
222
Configuration Inheritance
224
Using
Elements 225
226
227
228
229
Reading and Writing Configuration Sections Programmatically
230
The Website Administration Tool (WAT)
233
Extending the Configuration File Structure
235
Creating a Section Class
235
Registering a Section Class
237
Encrypting Configuration Sections
239
Programmatic Encryption
240
Command-Line Encryption
241
.NET Components
241
Creating a Component
242
Using a Component Through the App_Code Directory
244
Using a Component Through the Bin Directory
245
Extending the HTTP Pipeline
248
HTTP Handlers
248
Creating a Custom HTTP Handler
250
Configuring a Custom HTTP Handler
251
Using Configuration-Free HTTP Handlers
252
Creating an Advanced HTTP Handler
253
Creating an HTTP Handler for Non-HTML Content
255
HTTP Modules
258
Creating a Custom HTTP Module
260
Summary
263
CHAPTER 6 State Management
264
ASP.NET State Management
265
View State
267
A View State Example
268
Storing Objects in View State
270
Assessing View State
272
Selectively Disabling View State
273
View State Security
275
Transferring Information Between Pages
276
The Query String
276
Using the Query String
277
URL Encoding
278
Cross-Page Posting
278
Getting Page-Specific Information
280
Performing Cross-Page Posting in Any Event Handler
281
The IsPostBack and IsCrossPagePostBack Properties
282
Cross-Page Posting and Validation
283
Cookies
285
Session State
286
Session Architecture
286
Using Session State
288
Configuring Session State
289
Mode
290
Compression
294
Cookieless
295
Timeout
296
Securing Session State
296
Application State
297
Shared Application Variables
299
Summary
301
PART II Data Access
302
CHAPTER 7 ADO.NET Fundamentals
303
The ADO.NET Architecture
304
ADO.NET Data Providers
304
Standardization in ADO.NET
306
Fundamental ADO.NET Classes
307
The Connection Class
308
Connection Strings
308
User Instance Connections
310
Testing a Connection
311
Connection Pooling
313
The Command and DataReader Classes
315
Command Basics
315
The DataReader Class
316
The ExecuteReader() Method and the DataReader
317
Null Values
320
CommandBehavior
320
Processing Multiple Result Sets
321
The ExecuteScalar() Method
323
The ExecuteNonQuery() Method
324
SQL Injection Attacks
324
Using Parameterized Commands
327
Calling Stored Procedures
329
Transactions
332
Transactions and ASP.NET Applications
333
Stored Procedure Transactions
334
Client-Initiated ADO.NET Transactions
336
Isolation Levels
338
Savepoints
340
Provider-Agnostic Code
341
Creating the Factory
341
Create Objects with Factory
342
A Query with Provider-Agnostic Code
343
Summary
345
CHAPTER 8 Data Components and the DataSet
346
Building a Data Access Component
346
The Data Package
347
The Stored Procedures
349
The Data Utility Class
350
Concurrency Strategies
356
Testing the Database Component
357
Disconnected Data
359
Web Applications and the DataSet
360
XML Integration
361
The DataSet
361
The DataAdapter Class
363
Filling a DataSet
364
Working with Multiple Tables and Relationships
366
Searching for Specific Rows
369
Using the DataSet in a Data Access Class
370
Data Binding
371
The DataView Class
371
Sorting with a DataView
372
Filtering with a DataView
374
Advanced Filtering with Relationships
376
Calculated Columns
377
Summary
379
CHAPTER 9 Data Binding
380
Basic Data Binding
380
Single-Value Binding
381
Other Types of Expressions
383
Custom Expression Builders
384
Repeated-Value Binding
388
Binding to a DataReader
392
The Rich Data Controls
394
Binding to a DataView
396
Data Source Controls
396
The Page Life Cycle with Data Binding
397
The SqlDataSource
398
Selecting Records
399
Data Binding “Under the Hood”
401
Parameterized Commands
402
Stored Procedures
404
More Parameter Types
404
Handling Errors
407
Updating Records
408
Strict Concurrency Checking
409
Updating with Stored Procedures
411
Deleting Records
412
Inserting Records
413
Disadvantages of the SqlDataSource
413
The ObjectDataSource
414
Selecting Records
415
Using a Parameterized Constructor
417
Using Method Parameters
419
Updating Records
421
Updating with a Data Object
422
Dealing with Nonstandard Method Signatures
422
Handling Identity Values in an Insert
423
The Limits of the Data Source Controls
426
The Problem
426
Adding the Extra Items
427
Handling the Extra Options with the SqlDataSource
428
Handling the Extra Options with the ObjectDataSource
429
Summary
429
CHAPTER 10 Rich Data Controls
430
The GridView
431
Defining Columns
431
Formatting the GridView
435
Formatting Fields
436
Styles
437
Defining Styles
438
Configuring Styles with Visual Studio
440
Formatting-Specific Values
441
GridView Row Selection
443
Using Selection to Create a Master-Details Form
444
The SelectedIndexChanged Event
446
Using a Data Field As a Select Button
447
Sorting the GridView
447
Sorting with the SqlDataSource
448
Sorting with the ObjectDataSource
448
Sorting and Selection
450
Advanced Sorting
451
Paging the GridView
452
Automatic Paging
452
Paging and Selection
454
Custom Pagination with the ObjectDataSource
454
Counting the Records
455
A Stored Procedure to Get Paged Records
455
The Paged Selection Method
456
Customizing the Pager Bar
457
GridView Templates
459
Using Multiple Templates
461
Editing Templates in Visual Studio
462
Binding to a Method
463
Handling Events in a Template
465
Editing with a Template
466
Editing with Advanced Controls
468
Editing Without a Command Column
470
Client IDs in Templates
472
The ListView
473
Grouping
477
Paging
479
The DetailsView and FormView
480
The DetailsView
481
Defining Fields
482
Record Operations
482
The FormView
483
Advanced Grids
485
Summaries in the GridView
485
A Parent/Child View in a Single Table
487
Editing a Field Using a Lookup Table
490
Serving Images from a Database
492
Displaying Binary Data
493
Reading Binary Data Efficiently
494
Integrating Images with Other Content
495
Detecting Concurrency Conflicts
498
Summary
503
CHAPTER 11 Caching and Asynchronous Pages
504
Understanding ASP.NET Caching
504
Output Caching
505
Declarative Output Caching
505
Caching and the Query String
507
Caching with Specific Query String Parameters
508
Custom Caching Control
508
Caching with the HttpCachePolicy Class
510
Post-Cache Substitution and Fragment Caching
511
Fragment Caching
511
Post-Cache Substitution
511
Cache Profiles
513
Cache Configuration
514
Output Caching Extensibility
515
Building a Custom Cache Provider
515
Using a Custom Cache Provider
519
Data Caching
520
Adding Items to the Cache
520
A Simple Cache Test
523
Cache Priorities
524
Caching with the Data Source Controls
525
Caching with SqlDataSource
526
Caching with ObjectDataSource
528
Cache Dependencies
528
File and Cache Item Dependencies
529
Aggregate Dependencies
530
The Item Removed Callback
531
Understanding SQL Cache Notifications
533
How Cache Notifications Work
534
Enabling Notifications
535
Creating the Cache Dependency
536
Custom Cache Dependencies
537
A Basic Custom Cache Dependency
537
A Custom Cache Dependency Using Message Queues
538
Asynchronous Pages
541
Creating an Asynchronous Page
542
Querying Data in an Asynchronous Page
544
Handling Errors
547
Using Caching with Asynchronous Tasks
550
Multiple Asynchronous Tasks and Timeouts
552
Summary
554
CHAPTER 12 Files and Streams
555
Working with the File System
555
The Directory and File Classes
556
The DirectoryInfo and FileInfo Classes
558
The DriveInfo Class
561
Working with Attributes
562
Filter Files with Wildcards
564
Retrieving File Version Information
565
The Path Class
566
A File Browser
569
Reading and Writing Files with Streams
574
Text Files
575
Binary Files
577
Uploading Files
578
Making Files Safe for Multiple Users
580
Creating Unique Filenames
581
Locking File Access Objects
584
Compression
585
Serialization
586
Summary
589
CHAPTER 13 LINQ
590
LINQ Basics
590
Deferred Execution
592
How LINQ Works
593
LINQ Expressions
594
Projections
594
Filtering and Sorting
597
Grouping and Aggregation
598
LINQ Expressions “Under the Hood”
602
Extension Methods
602
Lambda Expressions
603
Multipart Expressions
604
LINQ to DataSet
604
Typed DataSets
607
Null Values
607
LINQ to Entities
608
Generating the Data Model
609
The Data Model Classes
609
The Derived Object Context Class
610
The Entity Classes
611
Entity Relationships
613
One-to-Many Relationships
613
One-to-One Relationships
614
Querying Stored Procedures
614
LINQ to Entities Queries “Under the Hood”
616
Filtering Too Late
617
Using Lazy and Eager Data Loading
618
Using Explicit Loading
620
Compiling Queries
621
Database Operations
622
Inserts
622
Creating Partially Populated Entity Classes
624
Inserting Associated Entities
624
Updates
626
Deletes
626
Managing Concurrency
627
Handling Concurrency Conflicts
628
The EntityDataSource Control
634
Displaying Data
634
Getting Related Data
638
Editing Data
639
Validation
640
Using the QueryExtender Control
642
Using a SearchExpression
642
Using a RangeExpression
643
Using a PropertyExpression
644
Using a MethodExpression
645
Summary
646
CHAPTER 14 XML
647
When Does Using XML Make Sense?
647
An Introduction to XML
648
The Advantages of XML
649
Well-Formed XML
650
XML Namespaces
650
XML Schemas
652
Stream-Based XML Processing
654
Writing XML Files
654
Reading XML Files
658
In-Memory XML Processing
661
The XmlDocument
662
The XPathNavigator
665
The XDocument
668
Creating XML with XDocument
668
Reading XML with XDocument
670
Namespaces
672
Searching XML Content
674
Searching with XmlDocument
674
Searching XmlDocument with XPath
677
Searching XDocument with LINQ
679
Validating XML Content
681
A Basic Schema
681
Validating with XmlDocument
682
Validating with XDocument
684
Transforming XML Content
685
A Basic Stylesheet
685
Using XslCompiledTransform
687
Using the Xml Control
688
Transforming XML with LINQ to XML
689
XML Data Binding
691
Nonhierarchical Binding
692
Using XPath
694
Nested Grids
697
Hierarchical Binding with the TreeView
698
Using XSLT
700
Binding to XML Content from Other Sources
702
Updating XML Through the XmlDataSource
703
XML and the ADO.NET DataSet
703
Converting the DataSet to XML
704
Summary
705
PART III Building ASP.NET Websites
707
CHAPTER 15 User Controls
708
User Control Basics
708
Creating a Simple User Control
709
Converting a Page to a User Control
711
Adding Code to a User Control
711
Handling Events
711
Adding Properties
712
Using Custom Objects
715
Adding Events
718
Exposing the Inner Web Control
721
Dynamically Loading User Controls
722
Portal Frameworks
723
Partial Page Caching
726
VaryByControl
727
Sharing Cached Controls
729
Summary
729
CHAPTER 16 Themes and Master Pages
730
Cascading Style Sheets
730
Creating a Stylesheet
730
Applying Stylesheet Rules
733
Themes
735
Theme Folders and Skins
736
Applying a Simple Theme
737
Handling Theme Conflicts
739
Creating Multiple Skins for the Same Control
740
Skins with Templates and Images
741
Using CSS in a Theme
743
Applying Themes Through a Configuration File
743
Applying Themes Dynamically
744
Standardizing Website Layout
746
Master Page Basics
746
A Simple Master Page
747
A Simple Content Page
749
Default Content
752
Master Pages with Tables and CSS Layout
752
Master Pages and Relative Paths
755
Applying Master Pages Through a Configuration File
756
Advanced Master Pages
757
Interacting with the Master Page Class
757
Dynamically Setting a Master Page
758
Nesting Master Pages
759
Summary
761
CHAPTER 17 Website Navigation
762
Pages with Multiple Views
763
The MultiView Control
763
The Wizard Control
767
Wizard Steps
768
Wizard Events
771
Wizard Styles, Templates, and Layout
773
Site Maps
776
Defining a Site Map
777
Binding to a Site Map
779
Breadcrumbs
780
Showing a Portion of the Site Map
782
Skipping the Root Node
783
Starting from the Current Node
783
Starting from a Specific Node
784
The Site Map Objects
786
Adding Custom Site Map Information
788
Creating a Custom SiteMapProvider
789
Storing Site Map Information in a Database
789
Creating the Site Map Provider
790
Adding Sorting
795
Adding Caching
795
Security Trimming
797
URL Mapping and Routing
799
URL Mapping
799
URL Routing
800
The TreeView Control
801
The TreeNode
802
Populating Nodes on Demand
805
TreeView Styles
807
Applying Styles to Node Types
809
Applying Styles to Node Levels
809
TreeView Images
810
The Menu Control
811
Menu Styles
814
Menu Templates
816
Summary
818
CHAPTER 18 Website Deployment
819
Installing and Configuring IIS
819
Installing IIS 7
819
Managing IIS 7
821
Deploying a Website
823
Deploying by Copying Files
824
Preparing IIS
824
The Website
825
Deploying the Website
825
Configuring the Deployment
827
Using Web Deployment
828
Preparing IIS
829
The Website
829
Transforming web.config
830
Publishing Databases
834
Deploying the Website
835
Using FTP Deployment
837
Preparing IIS
837
The Website
838
Deploying the Website
839
Variation: Deploying a Project-less Website
841
Managing a Website
844
Creating a New Site
844
Creating Virtual Directories
845
Using the VirtualPathProvider
846
Using Application Pools
850
Creating a New Application Pool
851
Assigning an Application to an Application Pool
852
Starting and Stopping an Application Pool
852
Using Side-by-Side Execution
852
Using Application Warm-Up
853
Preparing IIS 7
853
Configuring Application Warm-Up
853
Extending the Integrated Pipeline
854
Creating the Handler
855
Deploying the Handler
855
Configuring the Handler
855
Testing the Handler
857
Summary
857
PART IV Security
858
CHAPTER 19 The ASP.NET Security Model
859
What It Means to Create Secure Software
859
Understanding Potential Threats
859
Secure Coding Guidelines
860
Understanding Gatekeepers
861
Understanding the Levels of Security
862
Authentication
863
Impersonation
863
Authorization
863
Confidentiality and Integrity
864
Pulling It All Together
865
Understanding Secure Sockets Layer
866
Understanding Certificates
867
Understanding SSL
867
Configuring SSL in IIS 7.x
869
Configuring Bindings for SSL
871
Encoding Information with SSL
872
Summary
873
CHAPTER 20 Forms Authentication
874
Introducing Forms Authentication
874
Why Use Forms Authentication?
875
Controlling the Authentication Code
876
Controlling the Appearance of the Login Form
876
Working with a Range of Browsers
876
Storing User Information
876
Why Would You Not Use Forms Authentication?
877
Creating Your Own Login Interface
877
Maintaining User Details
877
Intercepting Network Traffic
878
Why Not Implement Cookie Authentication Yourself?
878
Keeping the Authentication Cookie Secure
878
Forms Authentication Is Well Tested
879
Integrating with the ASP.NET Security Framework
879
The Forms Authentication Classes
879
Implementing Forms Authentication
880
Configuring Forms Authentication
880
Credentials Store in web.config
883
Denying Access to Anonymous Users
884
Creating a Custom Login Page
885
Logging Out
889
Hashing Passwords in web.config
890
Cookieless Forms Authentication
891
Custom Credentials Store
892
Persistent Cookies in Forms Authentication
893
IIS 7.x and Forms Authentication
894
Summary
900
CHAPTER 21 Membership
901
Introducing the ASP.NET Membership API
901
Using the Membership API
904
Configuring Forms Authentication
905
Creating the Data Store
906
Database Scripts for ASP.NET Services
910
File-Based SQL Server Store
912
Configuring Connection String and Membership Provider
912
Creating and Authenticating Users
916
Using the Security Controls
918
The Login Control
919
Templates and the Login Control
925
Programming the Login Control
927
The LoginStatus Control
930
The LoginView Control
931
The PasswordRecovery Control
932
PasswordRecovery Templates
934
The ChangePassword Control
937
The CreateUserWizard Control
938
Configuring Membership in IIS 7.x
943
Configuring Providers and Users
943
Using the Membership API with Other Applications
945
Using the Membership Class
947
Retrieving Users from the Store
948
Updating Users in the Store
951
Creating and Deleting Users
951
Validating Users
952
Summary
952
CHAPTER 22 Windows Authentication
954
Introducing Windows Authentication
954
Why Use Windows Authentication?
954
Why Would You Not Use Windows Authentication?
956
Mechanisms for Windows Authentication
956
Basic Authentication
957
Digest Authentication
958
Integrated Windows Authentication
959
Implementing Windows Authentication
963
Configuring IIS 7.x
963
Configuring ASP.NET
965
Deeper Into the IIS 7.x Pipeline
965
Denying Access to Anonymous Users
969
Accessing Windows User Information
970
The WindowsPrincipal Class
971
The WindowsIdentity Class
972
IdentityReference and Role Information
974
Impersonation
976
Impersonation and Delegation in Windows
976
Configured Impersonation
978
Programmatic Impersonation
979
Getting a Token
979
Performing the Impersonation
980
Summary
982
CHAPTER 23 Authorization and Roles
983
URL Authorization
983
Authorization Rules
984
Controlling Access for Specific Users
985
Controlling Access to Specific Directories
987
Controlling Access to Specific Files
988
Controlling Access for Specific Roles
988
File Authorization
990
Authorization Checks in Code
990
Using the IsInRole() Method
990
Using the PrincipalPermission Class
991
Merging PrincipalPermission Objects
992
Using the PrincipalPermission Attribute
992
Using the Roles API for Role-Based Authorization
993
Using the LoginView Control with Roles
1001
Accessing Roles Programmatically
1002
Using the Roles API with Windows Authentication
1004
Authorization and Roles in IIS 7.x
1006
Authorization with ASP.NET Roles in IIS 7.x
1009
Managing ASP.NET Roles with IIS 7.x
1011
Summary
1012
CHAPTER 24 Profiles
1013
Understanding Profiles
1013
Profile Performance
1013
How Profiles Store Data
1014
Profiles and Authentication
1015
Profiles vs. Custom Data Components
1016
Using the SqlProfileProvider
1016
Creating the Profile Tables
1017
Configuring the Provider
1019
Defining Profile Properties
1020
Using Profile Properties
1021
Profile Serialization
1023
Profile Groups
1025
Profiles and Custom Data Types
1026
Custom Type Serialization
1027
Automatic Saves
1028
The Profiles API
1030
Anonymous Profiles
1033
Migrating Anonymous Profiles
1034
Custom Profile Providers
1035
The Custom Profile Provider Classes
1035
Designing the FactoredProfileProvider
1038
Coding the FactoredProfileProvider
1039
Initialization
1039
Reading Profile Information
1041
Updating Profile Information
1043
Testing the FactoredProfileProvider
1044
Summary
1047
CHAPTER 25 Cryptography
1048
Encrypting Data: Confidentiality Matters
1048
The .NET Cryptography Namespace
1049
Understanding the .NET Cryptography Classes
1052
Symmetric Encryption Algorithms
1054
Asymmetric Encryption
1055
The Abstract Encryption Classes
1056
The ICryptoTransform Interface
1056
The CryptoStream Class
1057
Encrypting Sensitive Data
1058
Managing Secrets
1058
Using Symmetric Algorithms
1060
Using the SymmetricEncryptionUtility Class
1065
Using Asymmetric Algorithms
1067
Encrypting Sensitive Data in a Database
1071
Encrypting the Query String
1076
Wrapping the Query String
1077
Creating a Test Page
1080
Summary
1082
CHAPTER 26 Custom Membership Providers
1083
Architecture of Custom Providers
1083
Basic Steps for Creating Custom Providers
1085
Overall Design of the Custom Provider
1085
Designing and Implementing the Custom Store
1087
Implementing the Provider Classes
1094
Creating Users and Adding Them to the Store
1100
Validating Users on Login
1104
Using Salted Password Hashes
1107
The Remaining Functions of the Provider
1109
Implementing the XmlRoleProvider
1111
Using the Custom Provider Classes
1118
Debugging Using the WAT
1119
Using Custom Providers with IIS 7.x
1120
Summary
1122
PART V Advanced User Interface
1123
CHAPTER 27 Custom Server Controls
1124
Custom Server Control Basics
1124
Creating a Bare-Bones Custom Control
1125
Using a Custom Control
1127
Custom Controls in the Toolbox
1128
Creating a Web Control That Supports Style Properties
1130
The Rendering Process
1134
Dealing with Different Browsers
1136
The HtmlTextWriter
1136
Browser Detection
1137
Browser Properties
1138
Overriding Browser Type Detection
1140
Adaptive Rendering
1141
Control State and Events
1142
View State
1142
Control State
1144
Postback Data and Change Events
1146
Triggering a Postback
1149
Extending Existing Web Controls
1151
Composite Controls
1151
Derived Controls
1154
Creating a Label for Specific Data
1154
Summary
1157
CHAPTER 28 Graphics, GDI+, and Charting
1158
The ImageMap Control
1158
Creating Hotspots
1159
Handling Hotspot Clicks
1160
A Custom Hotspot
1161
Drawing with GDI+
1164
Simple Drawing
1165
Image Format and Quality
1166
The Graphics Class
1168
Using a GraphicsPath
1171
Pens
1172
Brushes
1175
Embedding Dynamic Graphics in a Web Page
1177
Using the PNG Format
1178
Passing Information to Dynamic Images
1179
Custom Controls That Use GDI+
1182
The Custom Control Class
1183
The Rendering Page
1184
Using the Chart Control
1187
Creating a Basic Chart
1187
Populating a Chart with Data
1194
Binding to a Database Table
1194
Binding to a Object DataSource
1196
Binding to an XML File
1199
Binding to LINQ
1201
Summary
1202
CHAPTER 29 JavaScript and Ajax Techniques
1203
JavaScript Essentials
1203
The HTML Document Object Model
1204
Client-Side Events
1205
Adding JavaScript Attributes Declaratively
1207
The OnClientClick Property
1207
Script Blocks
1207
Manipulating HTML Elements
1209
Debugging JavaScript
1210
Basic JavaScript Examples
1213
Creating a JavaScript Page Processor
1213
Using JavaScript to Download Images Asynchronously
1217
Rendering Script Blocks
1222
Script Injection Attacks
1224
Request Validation
1224
Disabling Request Validation
1225
Extending Request Validation
1227
Custom Controls with JavaScript
1229
Pop-Up Windows
1230
Rollover Buttons
1235
Frames
1239
Frame Navigation
1239
Inline Frames
1241
Understanding Ajax
1243
The XMLHttpRequest Object
1244
Sending a Request
1244
Handling the Response
1245
An Ajax Example
1245
Using Ajax with Client Callbacks
1250
Creating a Client Callback
1251
Building the Basic Page
1252
Implementing the Callback
1252
Writing the Client-Side Script
1254
Disabling Event Validation
1256
Client Callbacks “Under the Hood”
1258
Client Callbacks in Custom Controls
1258
The DynamicPanel
1259
The DynamicPanelRefreshLink
1262
The Client Page
1263
Summary
1264
CHAPTER 30 ASP.NET AJAX
1265
Introducing ASP.NET AJAX
1265
ASP.NET AJAX on the Client: The Script Libraries
1266
ASP.NET AJAX on the Server: The ScriptManager
1267
Server Callbacks
1268
Web Services in ASP.NET AJAX
1268
Creating the Web Service
1270
Creating the Web Method
1271
Calling the Web Service
1274
Placing a Web Method in a Page
1277
ASP.NET AJAX Application Services
1278
Authentication Service
1279
Role Service
1281
Profile Service
1284
ASP.NET AJAX Server Controls
1286
Partial Rendering with the UpdatePanel
1287
Handling Errors
1289
Conditional Updates
1290
Interrupted Updates
1291
Triggers
1292
Optimizing the UpdatePanel
1293
Timed Refreshes with the Timer
1294
Time-Consuming Updates with UpdateProgress
1295
Cancellation
1297
Managing Browser History
1298
Adding History Points
1299
Restoring Page State
1301
How State Is Stored in the URL
1301
Deeper into the Client Libraries
1302
Understanding the Client Model
1302
Object-Oriented Programming in JavaScript
1303
Closures
1304
Prototypes
1306
Registering Classes with ASP.NET AJAX
1307
Base Types
1308
Namespaces
1309
Inheritance
1310
Interfaces
1311
The Web-Page Framework
1312
The Application Class
1312
The PageRequestManager Class
1313
A Client-Side AJAX Control
1314
Control Extenders
1317
Installing the ASP.NET AJAX Control Toolkit
1318
The AutoCompleteExtender
1319
The ASP.NET AJAX Control Toolkit
1323
Summary
1328
CHAPTER 31 Portals with Web Part Pages
1330
Typical Portal Pages
1331
Basic Web Part Pages
1332
Creating the Page Design
1333
WebPartManager and WebPartZone Controls
1334
Adding Web Parts to the Page
1336
Customizing the Page
1340
Creating Web Parts
1342
Simple Web Part Tasks
1343
Implementing the IWebPart Interface
1348
Developing Advanced Web Parts
1352
Before You Start: Creating Typed DataSets
1353
The Custom WebPart’s Skeleton
1354
Initializing the Web Part
1355
Loading Data and Processing Events
1356
The Final Rendering
1358
More Customization Steps
1359
Using the Web Part
1360
Web Part Editors
1361
Creating a Custom Editor
1364
Connecting Web Parts
1367
Defining the Communication Contract
1369
Implementing the Provider Web Part
1369
Creating the Consumer Web Part
1371
Static Connections Between Web Parts
1373
Dynamically Configuring Connection Points
1374
Multiple Connection Points
1375
Custom Verbs and Web Parts
1376
User Controls and Advanced Web Parts
1377
Uploading Web Parts Dynamically
1380
Authorizing Web Parts
1386
Final Tasks for Personalization
1387
Clearing Personalization
1387
Summary
1388
CHAPTER 32 MVC
1389
Choosing Between MVC and Web Forms
1389
Creating a Basic MVC Application
1390
Creating the Model
1390
Creating the Controller
1391
Creating the Index View
1392
Testing the (Incomplete) Application
1393
Completing the Controller and Views
1394
Modifying the Site.Master File
1397
Extending the Basic MVC Application
1397
Configuring Routing
1397
Adding Error Handling
1399
Adding Authentication
1401
Consolidating Data Store Access
1402
Adding Support for Foreign Key Constraints
1405
Customizing Views
1405
Modifying the View
1406
Adding View Data
1408
Adding to the Model
1410
Validating Data
1415
Performing Basic Validation
1416
Adding Validation Annotations
1418
Using Action Results
1421
Returning JSON Data
1422
Calling Another Controller Method
1423
Summary
1425
CHAPTER 33 Dynamic Data
1426
Creating a Dynamic Data Application
1426
Creating the Dynamic Data Site
1426
Exploring the Dynamic Data Site
1429
Understanding the Anatomy of a Dynamic Data Project
1432
Customizing a Dynamic Data Site
1433
Customizing with Templates
1433
Editing the Default Templates
1433
Creating a Custom Page Template
1434
Using Entity Templates
1435
Customizing Field Templates
1440
Customizing with Routes
1443
Understanding Routes
1443
Switching to Single-Page Editing
1448
Using Different Templates for Tables
1449
Customizing with Metadata
1453
Creating a Metadata Class
1453
Changing Display Names
1454
Changing Visibility
1457
Customizing Field Formatting
1459
Using a Custom Field Template
1461
Customizing Validation
1462
Requiring a Field Value
1462
Specifying a Valid Range
1463
Customizing Validation Using Extensibility Methods
1465
Summary
1467
CHAPTER 34 Silverlight
1468
Understanding Silverlight
1469
Silverlight vs. Flash
1470
Silverlight System Requirements
1472
Creating a Silverlight Solution
1473
Silverlight Compilation
1474
The Entry Page
1476
Creating a Silverlight Project
1480
Designing a Silverlight Page
1481
Understanding XAML
1485
Setting Properties
1487
The XAML Code-Behind
1488
Handling Events
1490
Browsing the Silverlight Class Libraries
1491
Layout
1492
The Canvas
1493
Layering Elements in a Canvas
1494
Dragging Circles
1495
The Grid
1499
Fine-Tuning Rows and Columns
1501
Nesting Layout Containers
1502
Spanning Rows and Columns
1504
Animation
1505
Animation Basics
1505
Defining an Animation
1505
The Animation Class
1506
The Storyboard Class
1506
Configuring Animation Properties
1509
An Interactive Animation Example
1510
Transforms
1514
Using a Transform
1515
Animating a Transform
1516
Using Web Services with Silverlight
1518
Creating the Web Service
1519
Adding a Web Reference
1519
Calling the Web Service
1521
Configuring the Web Service URL
1522
Cross-Domain Web Service Calls
1523
Summary
1525
Index
1526
Alle Preise verstehen sich inklusive der gesetzlichen MwSt.