You are previewing Programming Microsoft® ASP.NET 3.5.
O'Reilly logo
Programming Microsoft® ASP.NET 3.5

Book Description

Get the practical, popular reference written by ASP.NET authority Dino Esposito now updated for ASP.NET 3.5. An in-depth guide to the core features of Web development with ASP.NET, this book goes beyond the fundamentals. It expertly illustrates the intricacies and uses of ASP.NET 3.5 in a single volume. Part of Microsoft Visual Studio(r) 2008, ASP.NET 3.5 includes AJAX functionality, the Microsoft Silverlight cross-platform development tool, new controls, and new integration features. This pragmatic guide covers these new features, and also includes coverage of Windows(r) Communication Foundation, LINQ, and other key Microsoft .NET Framework 2.0, 3.0, and 3.5 capabilities. Complete with extensive code samples and code snippets in Microsoft Visual C# 2008, this is the ideal reference for developers who want to learn what s new in ASP.NET 3.5, or for those building professional-level Web development skills.

Table of Contents

  1. Programming Microsoft ASP.NET 3.5
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. Acknowledgements
    3. Introduction
      1. Who Is This Book For?
      2. System Requirements
      3. Find Additional Content Online
      4. The Companion Web Site
      5. Support for This Book
      6. Questions and Comments
    4. I. Building an ASP.NET Page
      1. 1. The ASP.NET Programming Model
        1. What's ASP.NET, Anyway?
          1. Programming in the Age of Web Forms
          2. Event-Driven Programming over HTTP
          3. The HTTP Protocol
          4. The HTTP Request
          5. The HTTP Response
          6. Building a Server-Side Abstraction Layer
          7. Submitting Forms
          8. Structure of an ASP.NET Page
          9. A Sample ASP.NET Page
          10. Quick Review of the Code
        2. The ASP.NET Component Model
          1. A Model for Component Interaction
          2. The runat Attribute
          3. Working with Server-Side Controls
          4. Pagewide Tags
          5. Unknown Tags
          6. ASP.NET Server Controls
          7. HTML Server Controls
          8. Web Server Controls
        3. The ASP.NET Development Stack
          1. The Presentation Layer
          2. Rich Controls
          3. Custom Controls
          4. Adaptive Rendering
          5. The Page Framework
          6. Page Events
          7. Page Scripting
          8. Page Personalization
          9. Page Styling
          10. Page Prototyping
          11. The HTTP Runtime Environment
          12. System HTTP Modules
          13. Application Configuration
          14. Application Services
        4. The ASP.NET Provider Model
          1. The Rationale Behind the Provider Model
          2. Exemplifying the Provider Model
          3. Benefits of the Provider Model
          4. A Quick Look at the ASP.NET Implementation
          5. The Provider Class
          6. The Configuration Layer
          7. The Storage Layer
          8. Available Types of Providers
        5. Conclusion
          1. Just the Facts
      2. 2. Web Development in Microsoft Visual Studio 2008
        1. Introducing Visual Studio 2008
          1. Visual Studio Highlights
            1. No IIS Dependency
          2. Multiple Ways to Access Web Sites
          3. Project Output Build Options
          4. Copying a Web Project
          5. Smarter Editing with Microsoft IntelliSense
          6. Visual Studio 2008–Specific New Features
          7. Multitarget Projects
          8. The JavaScript Debugger
            1. IntelliSense for JavaScript
          9. CSS Designer
          10. New Language Features
          11. Extension Methods
            1. Automatic Properties
          12. Object Initializers
          13. Type Inference and Anonymous Types
          14. LINQ Operators
        2. Create an ASP.NET Web Site Project
          1. Page Design Features
          2. Master Pages
          3. Nested Master Pages
          4. Content Pages
          5. Code-Behind Classes
          6. The Toolbox of Controls
          7. Editor's Special Capabilities
          8. Code Refactoring
          9. Import/Export of IDE Features
          10. Adding Code to the Project
          11. Defining Event Handlers
          12. Writing Helper Classes
          13. Building a Sample Shared Class
            1. A Look at the web.config File
          14. ASP.NET Protected Folders
          15. Additional Application Directories
            1. The App_Code Directory
          16. The Resource Directories
            1. Linked Web Services
          17. Available Themes
          18. Build the ASP.NET Project
          19. Debugging Features
            1. Testing the Application
        3. Application Deployment
          1. XCopy Deployment
          2. Copying Files
          3. Building a Setup Project
          4. What Else Do You Need to Do?
          5. Configuring the Runtime Environment
          6. Site Precompilation
          7. In-Place Precompilation
          8. Precompilation for Deployment
        4. Administering an ASP.NET Application
          1. The Web Site Administration Tool
          2. Membership and Role Management
          3. Application Settings Management
          4. Selecting and Configuring Providers
          5. Editing ASP.NET Configuration Files
            1. A Visual Editor for web.config Files
        5. Conclusion
          1. Just the Facts
      3. 3. Anatomy of an ASP.NET Page
        1. Invoking a Page
          1. The Runtime Machinery
          2. IIS 5.0 Process Model
          3. IIS 6.0 Process Model
          4. Representing the Requested Page
          5. Partial Classes in ASP.NET Projects
          6. Processing the Request
            1. The HttpRuntime Object
          7. The Application Factory
            1. The HttpApplication Object
          8. The Page Factory
          9. The Processing Directives of a Page
            1. The @Page Directive
            2. The @Assembly Directive
            3. The @Import Directive
            4. The @Implements Directive
            5. The @Reference Directive
        2. The Page Class
          1. Properties of the Page Class
          2. Intrinsic Objects
          3. Worker Properties
          4. Context Properties
          5. Methods of the Page Class
          6. Rendering Methods
          7. Controls-Related Methods
          8. Script-Related Methods
          9. Events of the Page Class
          10. The Eventing Model
          11. Introducing the View State
          12. The Single Form Model
          13. Asynchronous Pages
            1. The Async Attribute
            2. The AddOnPreRenderCompleteAsync Method
            3. The Significance of PreRenderComplete
          14. Building a Sample Asynchronous Page
            1. The RegisterAsyncTask Method
          15. Choosing the Right Approach
        3. The Page Life Cycle
          1. Page Setup
            1. The PreInit Event
            2. The Init Event
            3. The InitComplete Event
          2. View-State Restoration
          3. Processing Posted Data
            1. The PreLoad Event
            2. The Load Event
          4. Handling Dynamically Created Controls
          5. Handling the Postback
          6. Detecting Control State Changes
          7. Executing the Server-Side Postback Event
            1. The LoadComplete Event
          8. Page Finalization
            1. The PreRender Event
            2. The PreRenderComplete Event
            3. The SaveStateComplete Event
          9. Generating the Markup
            1. The Unload Event
        4. Conclusion
          1. Just the Facts
      4. 4. ASP.NET Core Server Controls
        1. Generalities of ASP.NET Server Controls
          1. Properties of the Control Class
          2. Identifying a Server Control
          3. Naming Containers
          4. Binding Containers
          5. Visibility of a Server Control
          6. Methods of the Control Class
          7. Events of the Control Class
          8. Other Features
          9. Adaptive Rendering
          10. Browser-Sensitive Rendering
          11. XHTML Compliance
          12. Themeable Controls
            1. Control State
          13. Input Focus
        2. HTML Controls
          1. Generalities of HTML Controls
            1. The HtmlControl Base Class
          2. Working with HTML Attributes
          3. Hierarchy of HTML Controls
          4. HTML Container Controls
            1. Managing Header Information
          5. Navigating to a URL
          6. Handling Events on the Server
            1. The HtmlSelect Control
          7. HTML Tables
            1. The HtmlTextArea Control
          8. HTML Input Controls
            1. Command Buttons
            2. Controlling Validation
          9. Detecting State Changes of Controls
          10. Uploading Files
          11. The HtmlImage Control
          12. Literal Controls
        3. Web Controls
          1. Generalities of Web Controls
          2. Properties of Web Controls
          3. Styling Web Controls
          4. Managing the Style of Web Controls
          5. Methods of Web Controls
          6. Core Web Controls
          7. Button Controls
          8. HyperLinks
          9. Images and Image Buttons
          10. Check Boxes and Radio Buttons
          11. Scrollable Panels
          12. Text Controls
          13. Hidden Fields and File Upload
          14. Miscellaneous Web Controls
            1. The AdRotator Control
            2. The Calendar Control
            3. The Xml Control
            4. The PlaceHolder Control
          15. View Controls
        4. Validation Controls
          1. Generalities of Validation Controls
            1. The BaseValidator Class
          2. Associating Validators with Input Controls
          3. Gallery of Controls
            1. The CompareValidator Control
            2. The CustomValidator Control
            3. The RegularExpressionValidator Control
            4. The RangeValidator Control
            5. The RequiredFieldValidator Control
          4. Special Capabilities
          5. Displaying Error Information
            1. The ValidationSummary Control
          6. Enabling Client Validation
          7. Validation Groups
        5. Conclusion
          1. Just The Facts
      5. 5. Working with the Page
        1. Programming with Forms
          1. The HtmlForm Class
            1. Properties of the HtmlForm Class
            2. Methods of the HtmlForm Class
          2. Multiple Forms
            1. Using HTML Forms
            2. Multiple <form> Tags on a Page
            3. Multiple View and Wizards
          3. Cross-Page Postings
            1. Posting Data to Another Page
            2. The @PreviousPageType Directive
            3. Detecting Cross-Page Postings
            4. Dealing with Validation
            5. Redirecting Users to Another Page
        2. Dealing with Page Errors
          1. Basics of Error Handling
            1. Default Error Pages
            2. Page-Level Error Handling
            3. Global Error Handling
            4. Robust Error Handling
          2. Mapping Errors to Pages
            1. The <customErrors> Section
            2. Using Custom Error Pages
            3. Handling Common HTTP Errors
            4. Getting Information About the Exception
        3. ASP.NET Tracing
          1. Tracing the Execution Flow in ASP.NET
            1. Enabling Page Tracing
            2. Enabling Tracing Programmatically
          2. Writing Trace Messages
            1. The TraceContext Class
            2. Emitting Trace Messages
            3. Tracing from External Classes
          3. The Trace Viewer
        4. Page Personalization
          1. Creating the User Profile
            1. Definition of the Data Model
            2. The User Profile Class Representation
            3. Using Collection Types
            4. Using Custom Types
            5. Grouping Properties
          2. Interacting with the Page
            1. Creating the Profile Database
            2. Working with Anonymous Users
            3. Accessing Profile Properties
            4. Personalization Events
            5. Migrating Anonymous Data
          3. Profile Providers
            1. Configuring Profile Providers
            2. Structure of AspNetDb.mdf
            3. Custom Profile Providers
        5. Conclusion
          1. Just The Facts
      6. 6. Rich Page Composition
        1. Working with Master Pages
          1. Authoring Rich Pages in ASP.NET 1.x
            1. What's Good About User Controls
            2. What's Bad About User Controls
            3. Visual Inheritance
          2. Writing a Master Page
            1. What's a Master Page, Anyway?
            2. The @Master Directive
            3. The ContentPlaceHolder Container Control
            4. Specifying Default Content
          3. Writing a Content Page
            1. The Content Control
            2. Attaching Pages to a Master
            3. Device-Specific Masters
            4. Setting the Title of a Page
          4. Processing Master and Content Pages
            1. Compiling Master Pages
            2. Serving the Page to Users
            3. Nested Master Pages
          5. Programming the Master Page
            1. Exposing Master Properties
            2. Invoking Properties on the Master
            3. The @MasterType Directive
            4. Changing the Master Page Dynamically
        2. Working with Themes
          1. Understanding ASP.NET Themes
            1. What's a Theme, Anyway?
            2. Structure of a Theme
            3. Customization Themes vs. Style Sheet Themes
          2. Theming Pages and Controls
            1. Enabling Themes on a Page
            2. Applying Skins
            3. Taking Control of Theming
            4. Theming Controls
          3. Putting Themes to Work
            1. CSS vs. Themes
            2. Creating a Theme
            3. Loading Themes Dynamically
        3. Working with Wizards
          1. An Overview of the Wizard Control
            1. Structure of a Wizard
            2. Wizard Styles and Templates
            3. The Wizard's Programming Interface
          2. Adding Steps to a Wizard
            1. Types of Wizard Steps
            2. Creating an Input Step
            3. Defining the Sidebar
          3. Navigating Through the Wizard
            1. Filtering Page Navigation with Events
            2. Canceling Events
            3. Finalizing the Wizard
        4. Conclusion
          1. Just the Facts
    5. II. Adding Data in an ASP.NET Site
      1. 7. ADO.NET Data Providers
        1. .NET Data Access Infrastructure
          1. .NET Managed Data Providers
          2. Building Blocks of a .NET Data Provider
          3. Interfaces of a .NET Data Provider
          4. Managed Providers vs. OLE DB Providers
          5. Data Sources You Access Through ADO.NET
          6. Accessing SQL Server
          7. Accessing Oracle Databases
          8. Using OLE DB Providers
          9. Using ODBC Drivers
          10. The Provider Factory Model
          11. Instantiating Providers Programmatically
          12. Enumerating Installed Data Providers
          13. Database-Agnostic Pages
        2. Connecting to Data Sources
          1. The SqlConnection Class
            1. Properties of the SqlConnection Class
            2. Methods of the SqlConnection Class
          2. Changing Passwords
          3. Accessing Schema Information
          4. Connection Strings
          5. Configuring Connection Properties
          6. Connection String Builders
          7. Storing and Retrieving Connection Strings
          8. Protecting Connection Strings
          9. Connection Pooling
          10. Configuring Pooling
          11. Getting and Releasing Objects
          12. Detecting Connections Leaks
          13. Managing Connection Lifetime
          14. Clearing the Connection Pool
        3. Executing Commands
          1. The SqlCommand Class
            1. Properties of the SqlCommand Class
            2. Methods of the SqlCommand Class
            3. Ways to Execute
          2. ADO.NET Data Readers
            1. Reading Data with the Data Reader
            2. Command Behaviors
            3. Closing the Reader
            4. Accessing Multiple Result Sets
          3. Asynchronous Commands
            1. Setting Up Asynchronous Commands
            2. Nonblocking Commands
            3. Executing Parallel Commands in an ASP.NET Page
            4. Nonblocking Data-Driven ASP.NET Pages
          4. Working with Transactions
            1. Managing Local Transactions as in ADO.NET 1.x
            2. Introducing the TransactionScope Object
            3. Distributed Transactions with TransactionScope
            4. Enlisting in a Distributed Transaction in ADO.NET 1.x
          5. SQL Server 2005–Specific Enhancements
            1. Support for CLR Types
            2. Support for XML as a Native Type
            3. SQL Notifications and Dependencies
            4. Multiple Active Result Sets
        4. Conclusion
          1. Just The Facts
      2. 8. ADO.NET Data Containers
        1. Data Adapters
          1. The SqlDataAdapter Class
            1. Programming the SQL Server Data Adapter
            2. Filling a DataSet Using a Data Adapter
            3. Loading Options
          2. The Table-Mapping Mechanism
            1. The Column-Mapping Mechanism
            2. Missing Mapping Action
            3. Missing Schema Action
            4. Prefilling the Schema
          3. How Batch Update Works
            1. Data Conflicts and Optimistic Lock
            2. Command Builders
        2. In-Memory Data Container Objects
          1. The DataSet Object
            1. Reading Stored Data
            2. Merging DataSet Objects
            3. The DataSet Commit Model
            4. Serializing Contents to XML
            5. Serialization and Remoting Format
          2. The DataTable Object
            1. Performing Computations
            2. Columns of a Table
            3. Rows of a Table
            4. Table Constraints
          3. Data Relations
            1. Creating a Data Relation
            2. Performing Calculations on Relations
            3. Serializing a Data Relation
          4. The DataView Object
            1. Navigating the View
            2. Finding Rows
        3. Conclusion
          1. Just The Facts
      3. 9. The Data-Binding Model
        1. Data Source-Based Data Binding
          1. Feasible Data Sources
          2. ADO.NET Classes
          3. Collection-Based Classes
          4. Data-Binding Properties
            1. The DataSource Property
            2. The DataSourceID Property
            3. The DataMember Property
            4. The DataTextField Property
            5. The DataValueField Property
            6. The AppendDataBoundItems Property
            7. The DataKeyField Property
          5. List Controls
            1. The DropDownList Control
            2. The CheckBoxList Control
            3. The RadioButtonList Control
            4. The ListBox Control
            5. The BulletedList Control
          6. Iterative Controls
            1. The Repeater Control
            2. The DataList Control
            3. The DataGrid Control
        2. Data-Binding Expressions
          1. Simple Data Binding
          2. Binding in Action
          3. Implementation of Data-Binding Expressions
          4. The DataBinder Class
            1. The Eval Method
            2. A More Compact Eval
          5. Getting the Default Data Item
          6. Other Data-Binding Methods
            1. The XPath Method
            2. The XPathSelect Method
            3. The Bind Method
          7. User-Defined Dynamic Expressions
        3. Data Source Components
          1. Overview of Data Source Components
            1. A Click in the Life of DataGrid
            2. A Click in the Life of GridView
          2. Internals of Data Source Controls
          3. Data Source Views
          4. Interaction with Data-Bound Controls
          5. Hierarchical Data Source Views
          6. The SqlDataSource Control
            1. Programming Interface of SqlDataSource
          7. Declarative Parameters
          8. Conflicts Detection
          9. Caching Behavior
          10. The AccessDataSource Class
          11. Working with an Access Database
          12. Updating an Access Database
          13. The ObjectDataSource Control
            1. Programming Interface of ObjectDataSource
          14. Implementing Data Retrieval
          15. Using Parameters
          16. Caching Data and Object Instances
          17. Setting Up for Paging
          18. Updating and Deleting Data
          19. Configuring Parameters at Runtime
          20. The LinqDataSource Class
          21. What's Linq-to-SQL, Anyway?
            1. The Goal of LinqDataSource
            2. Programming Interface of the LinqDataSource Control
            3. Events of the LinqDataSource Control
          22. Selecting, Sorting, and Filtering Data
            1. When the Select Property Is Not Enough
            2. Lazy Loading and Prefetch
          23. Updating Data
            1. LinqDataSource vs ObjectDataSource vs SqlDataSource
          24. The SiteMapDataSource Class
          25. Displaying Site Map Information
            1. Programming Interface of SiteMapDataSource
          26. The XmlDataSource Class
            1. Programming Interface of XmlDataSource
          27. Displaying XML Data
            1. Transforming XML Data
        4. Conclusion
          1. Just the Facts
      4. 10. The Linq-to-SQL Programming Model
        1. LINQ In Brief
          1. Language-Integrated Tools for Data Operations
            1. Making Sense of LINQ
            2. Linq-to-SQL
            3. Linq-to-XML
            4. Linq-to-DataSets
            5. Linq-to-Objects
          2. A Common Query Syntax
            1. Projection Operators
            2. Joining and Grouping
            3. Aggregation
            4. Partitioning
            5. Identifying Elements
          3. The Mechanics of LINQ
            1. The Layers of LINQ
            2. Mapping to the Data Source
            3. Executing the Query
        2. Working with SQL Server
          1. The Data Context
            1. Creating the Data Context
            2. Generating the Code
            3. Analyzing the Generated Code
            4. Extensibility Methods in the Generated Code
          2. Querying for Data
            1. Preparing the Query
            2. Inside a Sample Query
            3. Flat and Hierarchical Results
            4. Deferred Loading and Prefetching
            5. Preloading Data
            6. Linq-to-SQL Query Restrictions
          3. Updating Data
            1. Making Changes to the Data Context
            2. Adding and Deleting Objects
            3. Cross-Table Updates
            4. Optimistic Concurrency
            5. Customizing Update Operations
          4. Other Features
            1. Using Transactions
            2. Using Stored Procedures
            3. Using User-Defined Functions
        3. Conclusion
          1. Just the Facts
      5. 11. Creating Bindable Grids of Data
        1. The DataGrid Control
          1. The DataGrid Object Model
            1. Properties of the DataGrid Control
            2. Constituent Elements of a DataGrid
          2. Data Source Rows and Displayed Rows
            1. Events of the DataGrid Control
          3. Binding Data to the Grid
          4. Data-Bound Columns
          5. HyperLink Columns
          6. Button Columns
          7. Templated Columns
          8. Working with the DataGrid
          9. Paging Through the Data Source
          10. Sorting Columns of Data
          11. Editing Existing Rows
        2. The GridView Control
          1. The GridView Object Model
            1. Properties of the GridView Control
            2. Events of the GridView Control
          2. Simple Data Binding
          3. Binding Data to a GridView Control
          4. Configuring Columns
          5. Bound Fields
          6. Button Fields
          7. HyperLink Fields
          8. CheckBox Fields
          9. Image Fields
          10. Templated Fields
          11. Paging Data
          12. Codeless Data Paging
          13. Moving the Burden of Paging to the DAL
          14. Paging Algorithms
          15. Configuring the Pager
          16. Sorting Data
          17. Codeless Data Sorting
          18. Moving the Burden of Sorting to the DAL
          19. Give Users Feedback
          20. Using Callbacks for Paging and Sorting
          21. Editing Data
          22. In-Place Editing and Updates
          23. Deleting Displayed Records
          24. Inserting New Records
          25. Advanced Capabilities
          26. Executing an Operation on a Given Row
          27. Selecting a Given Row
          28. Row Customization
        3. Conclusion
          1. Just The Facts
      6. 12. Managing a List of Records
        1. The ListView Control
          1. The ListView Object Model
            1. Properties of the ListView Control
            2. Events of the ListView Control
          2. Compared to Other View Controls
            1. Simple Data Binding
          3. Defining the Layout of the List
          4. Building a Tabular Layout
          5. Definition of the Overall Layout
          6. Definition of the Item Template
          7. Using Alternate Rendering for Data Items
          8. Reflecting On the Table Layout
          9. Building a Flow Layout
          10. Definition of the Overall Layout
            1. Definition of the Item Layout
          11. Building a Tiled Layout
            1. Grouping Items
          12. Using the Group Separator Template
          13. Modifying the Group Item Count Dynamically
          14. Data-Driven Group Templates
          15. Styling the List
          16. Style Properties
          17. Using Cascading Style Sheets
        2. Working with the ListView Control
          1. In-Place Editing
          2. Defining the Edit Item Template
          3. Adding Predefined Command Buttons
            1. Adding Custom Command Buttons
          4. Conducting the Update
          5. Deleting an Existing Record
          6. Showing a Message Box upon Completion
          7. Inserting New Data Items
          8. Setting Up the Insert Item Template
            1. Taking Full Control of the Insert Template
          9. Adding a Bit of Validation
          10. Selecting an Item
          11. Triggering the Selection
            1. Releasing the Selection
          12. Paging the List of Items
            1. The DataPager Control
            2. Using the DataPager Control
          13. Configuring the Data Pager Fields
          14. Pageable Containers
            1. Sorting the List
        3. Conclusion
          1. Just the Facts
      7. 13. Managing Views of a Record
        1. The DetailsView Control
          1. The DetailsView Object Model
            1. Properties of the DetailsView
            2. Events of the DetailsView
            3. Simple Data Binding
          2. Binding Data to a DetailsView Control
            1. Controlling the Displayed Fields
            2. Paging Through Bound Data
            3. Paging via Callbacks
          3. Creating Master/Detail Views
            1. Drill Down into the Selected Record
            2. Caching Issues
          4. Working with Data
            1. Editing the Current Record
            2. Deleting the Current Record
            3. Inserting a New Record
            4. Templated Fields
            5. Adding Validation Support
            6. Validating Without Validators
        2. The FormView Control
          1. The FormView Object Model
            1. Members of the FormView Control
            2. Supported Templates
            3. Supported Operations
          2. Binding Data to a FormView Control
            1. Header, Footer, and Pager
            2. Displaying Data
            3. The Eval Function
          3. Editing Data
            1. The Edit Template
            2. The Bind Function
            3. The Insert Template
            4. When the Function Is Not Supported
        3. Conclusion
          1. Just The Facts
    6. III. ASP.NET Infrastructure
      1. 14. The HTTP Request Context
        1. Initialization of the Application
          1. Properties of the HttpApplication Class
          2. Application Modules
          3. Methods of the HttpApplication Class
          4. Events of the HttpApplication Class
        2. The global.asax File
          1. Compiling global.asax
          2. Syntax of global.asax
            1. Application Directives
            2. Code Declaration Blocks
            3. Server-Side <object> Tags
            4. Server-Side Includes
            5. Static Properties
          3. Tracking Errors and Anomalies
        3. The HttpContext Class
          1. Properties of the HttpContext Class
          2. Methods of the HttpContext Class
            1. URL Rewriting
            2. Loading Resources Programmatically
        4. The Server Object
          1. Properties of the HttpServerUtility Class
          2. Methods of the HttpServerUtility Class
            1. Embedding Another Page's Results
            2. Server-Side Redirection
            3. Late-Bound COM Objects
            4. The Importance of AspCompat
        5. The HttpResponse Object
          1. Properties of the HttpResponse Class
            1. Setting the Response Cache Policy
            2. Setting an Output Filter
          2. Methods of the HttpResponse Class
            1. Output Caching Features
            2. Large File Transmission
        6. The HttpRequest Object
          1. Properties of the HttpRequest Class
            1. Information About the Request
            2. Information from the Client
            3. Information About the Connection
          2. Methods of the HttpRequest Class
            1. Saving the Request to Disk
            2. Validating Client Input
        7. Conclusion
          1. Just the Facts
      2. 15. ASP.NET State Management
        1. The Application's State
          1. Properties of the HttpApplicationState Class
          2. Methods of the HttpApplicationState Class
          3. State Synchronization
          4. Tradeoffs of Application State
          5. Memory Occupation
          6. Concurrent Access to Data
        2. The Session's State
          1. The Session-State HTTP Module
          2. State Client Managers
            1. Creating the HttpSessionState Object
          3. Synchronizing Access to the Session State
          4. Properties of the HttpSessionState Class
          5. Methods of the HttpSessionState Class
        3. Working with a Session's State
          1. Identifying a Session
          2. Generating the Session ID
          3. Session Cookies
          4. Cookieless Sessions
          5. Issues with Cookieless Sessions
          6. Cookieless Sessions and Security
          7. Configuring the Session State
          8. Lifetime of a Session
            1. The Session_Start Event
            2. The Session_End Event
          9. Why Does My Session State Sometimes Get Lost?
          10. Persist Session Data to Remote Servers
          11. State Serialization and Deserialization
          12. Storing Session Data
            1. Configuring the StateServer Provider
          13. Persist Session Data to SQL Server
          14. Performance and Robustness
          15. Configuring Session State for SQL Server Support
          16. Creating the SQL Server Data Store
          17. Reverting to the Hosting Identity
        4. Customizing Session State Management
          1. Building a Custom Session State Provider
          2. Defining the Session State Store
          3. Locking and Expiration
          4. Replacing the Session Data Dictionary
          5. Registering a Custom Session State Provider
          6. Generating a Custom Session ID
          7. The Default Behavior
          8. A Homemade Session ID Manager
        5. The View State of a Page
          1. The StateBag Class
          2. View State Properties
          3. View State Methods
          4. Common Issues with View State
          5. Encrypting and Securing
          6. Machine Authentication Check
          7. Size Thresholds and Page Throughput
          8. Programming Web Forms Without View State
          9. Disabling View State
          10. Determining When to Disable View State
          11. Changes in the ASP.NET View State
          12. The Serialization Format
          13. The Control State
          14. Programming the Control State
          15. Keeping the View State on the Server
            1. The LosFormatter Class
            2. The ObjectStateFormatter Class
          16. Creating a View-State-Less Page
            1. Creating a File-based State Persister
        6. Conclusion
          1. Just the Facts
      3. 16. ASP.NET Caching
        1. Caching Application Data
          1. The Cache Class
            1. Cache and Other State Objects
            2. Properties of the Cache Class
            3. Methods of the Cache Class
            4. An Interior View
          2. Working with the ASP.NET Cache
            1. Inserting New Items in the Cache
            2. Removing Items from the Cache
            3. Tracking Item Dependencies
            4. Defining a Removal Callback
            5. Setting the Item's Priority
            6. Controlling Data Expiration
          3. Practical Issues
            1. Should I Cache or Should I Fetch?
            2. Building a Wrapper Cache Object
            3. Enumerating Items in the Cache
            4. Clearing the Cache
            5. Cache Synchronization
            6. Per-Request Caching
          4. Designing a Custom Dependency
            1. What Cache Dependencies Cannot Do in ASP.NET 1.x
            2. Extensions to the CacheDependency Base Class
            3. Getting Change Notifications
            4. The AggregateCacheDependency Class
          5. A Cache Dependency for XML Data
            1. Designing the XmlDataCacheDependency Class
            2. Implementing the Dependency
            3. Testing the Custom Dependency
          6. SQL Server Cache Dependency
            1. Under the Hood of Database Dependencies
            2. Enabling Database Dependencies
            3. Taking Advantage of SQL Server Dependencies
            4. Cache Dependencies in SQL Server 2005
        2. Caching ASP.NET Pages
          1. The @OutputCache Directive
            1. Choosing a Duration for the Page Output
            2. Choosing a Location for the Page Output
            3. Adding a Database Dependency to Page Output
          2. The HttpCachePolicy Class
            1. Properties of the HttpCachePolicy Class
            2. Methods of the HttpCachePolicy Class
            3. Server Cache-Validation Callback
          3. Caching Multiple Versions of a Page
            1. Vary By Parameters
          4. Dealing with Postback Pages
            1. Vary By Headers
            2. Vary By Custom Strings
          5. Caching Portions of ASP.NET Pages
            1. What's a User Control, Anyway?
            2. Caching the Output of User Controls
            3. Vary by Controls
            4. The Shared Attribute
            5. Fragment Caching in Cacheable Pages
            6. Advanced Caching Features
            7. Caching Profiles
            8. Post-Cache Substitution
        3. Conclusion
          1. Just the Facts
      4. 17. ASP.NET Security
        1. Where the Threats Come From
        2. The ASP.NET Security Context
          1. Who Really Runs My ASP.NET Application?
            1. IIS Thread Security Context
            2. Worker Process Security Context
            3. ASP.NET Pipeline Security Context
          2. Changing the Identity of the ASP.NET Process
            1. Setting the Process Account
            2. Impersonating a Fixed Identity
            3. Impersonating Through the Anonymous Account
            4. Privileges of the ASP.NET Default Account
          3. The Trust Level of ASP.NET Applications
            1. The <trust> Section
            2. ASP.NET Permissions
            3. Granting Privileges Beyond the Trust Level
          4. ASP.NET Authentication Methods
            1. Windows Authentication
            2. Using ACLs to Authorize Access
            3. Passport Authentication
        3. Using Forms Authentication
          1. Forms Authentication Control Flow
            1. Collecting Credentials Through Login
            2. Authenticating the User
            3. Signing Out
          2. The FormsAuthentication Class
            1. Properties of the FormsAuthentication Class
            2. Methods of the FormsAuthentication Class
          3. Configuration of Forms Authentication
            1. The <forms> Section
            2. Cookie-Based Forms Authentication
            3. Cookieless Forms Authentication
            4. Options for Cookieless Authentication
          4. Advanced Forms Authentication Features
            1. Applications to Share Authentication Cookies
            2. External Applications to Authenticate Users
            3. Forms Authentication and Secured Sockets
            4. General Security Issues
        4. The Membership and Role Management API
          1. The Membership Class
            1. The Programming Interface of the Membership Class
            2. Setting Up Membership Support
            3. Validating Users
            4. Managing Users and Passwords
          2. The Membership Provider
            1. The ProviderBase Class
            2. The MembershipProvider Class
            3. Extending the Provider's Interface
            4. A Custom Provider for ASP.NET 1.x Code
            5. Configuring a Membership Provider
          3. Managing Roles
            1. The Role Management API
            2. The Roles Class
            3. The Role Provider
        5. Security-Related Controls
          1. The Login Control
            1. Setting Up the Login Control
            2. The Programming Interface of the Control
            3. Events of the Control
          2. The LoginName Control
          3. The LoginStatus Control
            1. Setting Up the LoginStatus Control
            2. The Programming Interface of the Control
          4. The LoginView Control
            1. The Programming Interface of the Control
            2. Creating a Login Template
            3. Creating Role-Based Templates
          5. The PasswordRecovery Control
            1. Requirements for Password Retrieval
            2. Retrieving a Password
          6. The ChangePassword Control
            1. User Authentication
            2. Password Change
          7. The CreateUserWizard Control
        6. Conclusion
          1. Just the Facts
      5. 18. HTTP Handlers and Modules
        1. Quick Overview of the IIS Extensibility API
          1. The ISAPI Model
            1. Illustrious Children of the ISAPI Model
            2. Structure of ISAPI Components
            3. ISAPI Extensions
            4. ISAPI Filters
          2. Changes in IIS 7.0
            1. A Unified Runtime Environment
            2. Managed ISAPI Extensions and Filters
        2. Writing HTTP Handlers
          1. The IHttpHandler Interface
            1. Members of the IHttpHandler Interface
            2. A Very Simple HTTP Handler
          2. An HTTP Handler for Quick Data Reports
            1. Building a Query Manager Tool
            2. Registering the Handler
            3. Registering the Handler with IIS 7.0
          3. The Picture Viewer Handler
            1. Designing the HTTP Handler
            2. Implementing the HTTP Handler
          4. Serving Images More Effectively
            1. Loading Images from Databases
            2. Serving Dynamically Generated Images
            3. Writing Copyright Notes on Images
          5. Advanced HTTP Handler Programming
            1. Deploying Handlers as ASHX Resources
            2. Prevent Access to Forbidden Resources
            3. Should It Be Reusable or Not?
            4. HTTP Handler Factories
            5. Asynchronous Handlers
            6. Implementing Asynchronous Handlers
        3. Writing HTTP Modules
          1. The IHttpModule Interface
          2. A Custom HTTP Module
            1. Wiring Up Events
            2. Registering with the Configuration File
            3. Accessing Other HTTP Modules
          3. The Page Refresh Feature
            1. The Rationale Behind Page Refresh Operations
            2. Outline of the Solution
            3. Implementation of the Solution
        4. Conclusion
          1. Just the Facts
    7. IV. ASP.NET AJAX Extensions
      1. 19. Partial Rendering: The Easy Way to AJAX
        1. The ASP.NET AJAX Infrastructure
          1. The Hidden Engine of AJAX
            1. The Classic Browser-Led Model
            2. The New Out-of-Band Model
            3. The Role of the HTML Document Object Model
            4. From Dynamic HTML to the Standard DOM
            5. The XMLHttpRequest Object
            6. Using the XMLHttpRequest Object
          2. The Microsoft AJAX JavaScript Library
            1. JavaScript Language Extensions
            2. Object-Oriented Extensions: Namespaces
            3. Object-Oriented Extensions: Inheritance
            4. Object-Oriented Extensions: Interfaces
            5. The Application Core Component
            6. The Network Stack
            7. DOM Events
            8. Other Facilities
          3. The Script Manager Control
            1. Properties of the ScriptManager Control
            2. Methods of the ScriptManager Control
            3. Events of the ScriptManager Control
            4. The ScriptManagerProxy Control
            5. Script Binding and Loading
            6. Handling Debug and Release Script Files
            7. Localized Scripts
            8. Script Globalization
        2. Selective Page Updates with Partial Rendering
          1. The UpdatePanel Control
            1. The UpdatePanel Control at a Glance
            2. The Programming Interface of the Control
            3. Populating the Panel Programmatically
            4. Master Pages and Updatable Regions
            5. User Controls and Updatable Regions
          2. Optimizing the Usage of the UpdatePanel Control
            1. Configuring for Conditional Refresh
            2. Programmatic Updates
            3. Using Triggers
            4. Full Postbacks from Inside Updatable Panels
            5. Practical Steps for Adopting Updatable Panels
          3. Giving Feedback to the User
            1. The UpdateProgress Control
            2. Composing the Progress Screen
            3. Client-Side Events for Richer Feedback
            4. Disabling Visual Elements During Updates
            5. Aborting a Pending Update
          4. Light and Shade of Partial Rendering
            1. Issues with Concurrent Calls
            2. Issues with Polling
        3. The AJAX Control Toolkit
          1. Enhancing Controls with Extenders
            1. Extenders at a Glance: the TextBoxWatermark Control
            2. Creating a New Extender Control
            3. Extenders in the ACT
            4. Controls in the ACT
          2. Improving the User Interface with Input Extenders
            1. Motivation for Input Facilities
            2. The Slider Extender
            3. The NumericUpDown Extender
            4. The FilteredTextBox Extender
            5. The Calendar Extender
            6. The MaskedEdit Extender
            7. The AutoComplete Extender
          3. Adding Safe Popup Capabilities to Web Pages
            1. The ModalPopup Extender
            2. The PopupControl Extender
            3. The HoverMenu Extender
            4. The TabContainer Control
        4. Conclusion
          1. Just the Facts
      2. 20. AJAX-Enabled Web Services
        1. Implementing the AJAX Paradigm
          1. Moving Away from Partial Rendering
            1. The Flip Side of Partial Rendering
            2. The ASP.NET AJAX Emerging Model
          2. Designing the –Client Layer of an ASP.NET AJAX Application
            1. Limits of JavaScript
            2. Enriching JavaScript
            3. Limits of the HTML Markup Language
            4. What About AJAX-Specific Controls?
          3. Designing the –Server Layer of ASP.NET AJAX Applications
            1. A Service-Oriented –Server-Side Architecture
            2. REST Services
            3. Data Serialization
            4. JSON vs. XML
        2. Web Services for ASP.NET AJAX Applications
          1. Web Services as Application-Specific Services
            1. Defining the Remote API
            2. Implementing the Contracted Interface
            3. Publishing the Contract
          2. Remote Calls via Web Services
            1. Creating an AJAX Web Service
            2. The ScriptService Attribute
            3. Blocking SOAP Clients
            4. Defining Methods for a Web Service
            5. Registering AJAX Web Services
            6. Configuring ASP.NET Applications to Host AJAX Web Services
          3. Consuming AJAX Web Services
            1. The Proxy Class
            2. Executing Remote Calls
            3. Error Handling
            4. Giving User Feedback
            5. Handling Timeouts
          4. Considerations for AJAX-Enabled Web Services
            1. Why Local Web Services?
            2. Why JSON-Based Web Services?
            3. Runtime Support for JSON-Based Web Services
        3. WCF Services for ASP.NET AJAX Applications
          1. Building a Simple WCF Service
            1. Rewriting TimeService as a WCF Service
            2. Registering the Service
            3. Testing the Service
            4. ASP.NET Compatibility Modes
          2. Building a Less Simple Service
            1. The Suggestions Service
            2. Service Without Configuration
            3. Data Contracts
        4. Remote Calls via Page Methods
          1. Introducing Page Methods
            1. Defining a Page Method
            2. Enabling Page Methods
            3. Why No Page Life Cycle?
          2. Consuming Page Methods
            1. The Proxy Class
            2. Executing Page Methods
            3. Page Methods vs. AJAX-Enabled Services
        5. Conclusion
          1. Just the Facts
      3. 21. Silverlight and Rich Internet Applications
        1. Silverlight Fast Facts
          1. Versions of Silverlight
          2. Silverlight 1.0
          3. Silverlight 2.0
          4. Silverlight and Flash
          5. Programmability
          6. Reach and Adoption
          7. Audio/Video
          8. Animation and Graphics
        2. Hosting Silverlight in Web Pages
          1. The Silverlight Engine
          2. The Silverlight Object
          3. The Script-Behind File
          4. Embedding the Silverlight Object
          5. Checking the Installed Version
          6. Instantiating the Silverlight Object
          7. Initialization of the Plug-in
          8. Error Handling
          9. Defining XAML Content
          10. Downloading XAML Documents
          11. Inline XAML
          12. Dynamically Generated XAML
          13. The XAML Syntax in Silverlight
          14. Syntax Highlights
          15. The Canvas Object
          16. Graphics and Shapes
          17. Clipping and Transforming
          18. Animation
          19. Text
          20. Multimedia
        3. The Silverlight Object Model
          1. Silverlight Programming Fundamentals
          2. Referencing Objects
          3. The Silverlight Eventing Model
          4. Writing Event Handlers
          5. Accessing Properties of XAML Elements
          6. Scripting and Animation Together
          7. Resizing the Silverlight Area
          8. Introducing Silverlight 2.0
          9. The Visual Studio 2008 Template Project
          10. The XAML Code-Behind Class
          11. The Object Model
          12. Reading and Writing Properties
          13. Accessing the HTML DOM
        4. Conclusion
          1. Just the Facts
    8. SPECIAL OFFER: Upgrade this ebook with O’Reilly