Microsoft® ASP.NET and AJAX: Architecting Web Applications

Book description

Rethink the way you plan, design, and build Web applications with expert guidance from Web development luminary Dino Esposito. Whether giving legacy sites a much-needed tune-up or architecting rich Internet applications from the ground up you ll learn pragmatic approaches to AJAX development that you can employ today. Discover how to: Delve into the mechanics and design goals of partial rendering such as improving page-refresh speed Use AJAX-enabled server controls to bring desktop-like functionality to Web solutions Apply design patterns to common Web development issues, including client-side data binding Manipulate JavaScript more easily using the jQuery and Microsoft AJAX libraries Examine the interoperability and security models in Microsoft Silverlight Weigh the tradeoffs when architecting Web applications for richness (Silverlight) vs. reach (AJAX) and deliver the right solution for your audience

Table of contents

  1. Microsoft® ASP.NET and AJAX: Architecting Web Applications
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. Acknowledgments
    3. Introduction
      1. Who This Book Is For
      2. Companion Content
      3. Hardware and Software Requirements
      4. Find Additional Content Online
      5. Support for This Book
        1. Questions and Comments
    4. I. The (Much Needed) Facelift for the Old Web
      1. 1. Under the Umbrella of AJAX
        1. What Web Do We Want?
          1. It’s All About User Experience
            1. User Experience for Dummies
            2. User Experience for the Poor Web User
            3. User Experience for Developers
            4. User Experience for Managers
          2. Origins of the Web
            1. The First Cry
            2. The Mechanics of the Web
            3. The Original Purpose of HTML and HTTP
          3. Paradox of the Web
            1. The Sturdy, Old Columns That Hold Up the Web
            2. Pillars Can’t Be Changed
        2. The Biggest Benefit of AJAX
          1. What’s AJAX, Exactly?
            1. A New Way to Do Web Programming
            2. The XMLHttpRequest Object
            3. The Document Object Model
          2. The Paradigm Shift
            1. The Pages-for-Forms Model
            2. The Data-for-Data Model
            3. Refactoring to AJAX: Features, Pages, and Applications
        3. AJAX and New Web Projects
          1. Adding AJAX Capabilities
            1. Selective Updates
            2. Costs and Benefits
          2. Architecture Is the Concern
            1. Some Common Architectural Concerns
            2. Two Tiers and a Data Format
            3. JSON as the Fat-Free Alternative to XML
            4. Costs and Benefits
          3. The Case for Rich Internet Applications
            1. Reach vs. Rich
            2. RIA Offers Better HTML
            3. RIA Offers Better JavaScript
        4. Summary
      2. 2. The Easy Way to AJAX
        1. The ASP.NET AJAX Infrastructure
          1. The Page’s Script Manager
            1. The ScriptManager Control
            2. Logistics for Partial Rendering
            3. Scripts, Just Served Better
            4. Scripts, Just Made Global
            5. Adding Service References to Pages
            6. Defining History Points Within Pages
          2. The Microsoft JavaScript Library
            1. A Richer JavaScript Is Here
            2. Pros and Cons of the JavaScript Language
            3. Adding Object-Orientation to JavaScript
        2. Partial Rendering
          1. The UpdatePanel Control
            1. Motivation for Partial Rendering
            2. The Syntax at a Glance
            3. Mechanics of Partial Rendering
            4. Server-Side Partial Rendering
            5. Role of View State
            6. Smooth Page Updates
          2. Programming Updatable Panels
            1. Conditional Updates
            2. Commanding Programmatic Updates
            3. Dynamic Templates
            4. Additional Capabilities
          3. Minimizing Data Transfer
            1. Golden Rules for Placing UpdatePanels
            2. Crunching the Numbers for Partial Rendering
          4. Shades of Partial Rendering
            1. User Feedback
            2. Disabling Visual Elements During Updates
            3. Issues with Concurrent Calls
            4. Issues with Polling
        3. AJAX and JavaScript Injections
          1. Remote Methods
            1. Page Methods
            2. Invoking Page Methods
            3. Page Methods vs. Services
          2. Widgets and Effects
            1. AJAX Control Toolkit
            2. The jQuery Library
        4. Summary
      3. 3. AJAX Architectures
        1. The AJAX Service Layer Pattern
          1. Architectural Overview
            1. HTTP Façade
            2. HTTP Façade and the Service Layer Pattern
            3. Technologies for the HTTP Façade
            4. Data Transfer and Data Formats
            5. Why JSON Is Preferable to XML
            6. HTML Presentation Layer
          2. Inside the HTTP Façade
            1. Anatomy of an HTTP Request
            2. WCF Services
            3. ASP.NET Web Services
            4. Custom Services
            5. ADO.NET Data Services
          3. The AJAX Presentation Layer
            1. Getting a Proxy for the HTTP Façade
            2. Using the Proxy
            3. The JavaScript Model-Controller Pattern
          4. Security Considerations
            1. The HTTP Façade Is Not Your Middle Tier
            2. Built-in Security Countermeasures
            3. Replay Attacks
            4. Discriminate Against Outsiders
            5. Trusting the HTTP Façade
        2. The AJAX Server Pages Pattern
          1. Architectural Overview
            1. Classic ASP.NET Server Controls
            2. Increasing JavaScript Emissions in the Page
            3. Code-Behind and Service Layer
          2. The Classic Postback Model Revisited
            1. It’s Always a Postback
            2. A Smarter Form of Partial Rendering
          3. Libraries in Action
            1. Telerik’s RadControls for ASP.NET AJAX
            2. Gaiaware’s Gaia AJAX
        3. Summary
    5. II. Power to the Client
      1. 4. A Better and Richer JavaScript
        1. JavaScript Today
          1. The Language and the Browser
            1. Original Goals of the Language
            2. The Scripting Engine
            3. Recognized Flaws
          2. Pillars of the Language
            1. Objects as Dictionaries
            2. Functions as Objects
            3. Dynamic Typing
            4. Closures and Prototypes
          3. JavaScript (If Any) of the Future
            1. Overhauling the Language
            2. It’s All About Security
            3. Google’s V8 Engine
        2. The Microsoft AJAX Library
          1. Overview of the Library
            1. Constituent Files
            2. Linking the Microsoft AJAX Library
            3. No Bells and Whistles
          2. JavaScript Language Extensions
            1. Primitive Types
            2. New Types
            3. Shorthand Functions
          3. Object-Oriented Extensions
            1. Namespaces and Classes
            2. Inheritance and Polymorphism
            3. Interfaces
          4. Framework Facilities
            1. Reflection
            2. The Application Object
            3. String Manipulation
            4. Debugging
            5. The Network Stack
            6. The Eventing Model
        3. Summary
      2. 5. JavaScript Libraries
        1. From Server Controls to JavaScript Widgets
          1. The ASP.NET Factor
            1. Why Was ASP.NET a Milestone?
            2. The Wind Is Changing for Server Controls
          2. The Widget Factor
            1. Most Popular Libraries
            2. The Dojo Library
            3. The ExtJS Library
            4. The PrototypeJS Library
            5. The Script.aculo.us Library
            6. The Yahoo! UI Library
            7. Libraries and the Process of Natural Selection
        2. The jQuery Library
          1. The Library at a Glance
            1. Size of the Library
            2. Fundamental Traits
            3. Using the Library in Visual Studio 2008
          2. The Core Library
            1. The $ Function
            2. Wrapped Sets
            3. Helper Methods of the $ Function
          3. jQuery Selectors
            1. CSS Selectors
            2. CSS Selectors in Action
            3. Filters
            4. Form Filters
          4. Working on Wrapped Sets
            1. Looping over Wrapped Sets
            2. Some Predefined Operations
            3. Chaining Methods
          5. jQuery Utilities
            1. Event Handling
            2. Visual Effects
            3. AJAX Functions
            4. Caching
            5. jQuery Plug-ins
        3. Summary
      3. 6. AJAX Design Patterns
        1. Design Patterns and Code Development
          1. Generalities About Design Patterns
            1. Applying Design Patterns
            2. The Real Value of Patterns
            3. Patterns and Idioms
          2. Patterns in AJAX Development
            1. Dynamic Data Download
            2. Page DOM Manipulation
            3. User Actions
            4. Unique URL
        2. Patterns for JavaScript Development
          1. The Singleton Pattern
            1. Generalities of the Singleton Pattern
            2. The Singleton Pattern Used with the Microsoft AJAX Client Library
          2. The Model-View-Controller Pattern
            1. Generalities of the MVC Pattern
            2. MVC in JavaScript
          3. The On-Demand JavaScript Pattern
            1. Generalities of the On-Demand JavaScript Pattern
            2. Using XMLHttpRequest to Download Scripts on Demand
            3. Using the DOM to Download Scripts on Demand
        3. The Predictive Fetch Pattern
          1. Generalities of the Predictive Fetch Pattern
            1. Details of the Predictive Fetch Pattern
            2. Motivations for Using the Predictive Fetch Pattern
            3. Open Points Regarding the Predictive Fetch Pattern
          2. Creating a Reference Implementation
            1. A Sample Scenario for the Predictive Fetch Pattern
            2. Managing Remote Calls
            3. Caching Makes Applications Faster and Prettier
            4. Summary of the Predictive Fetch Pattern
        4. The Timeout Pattern
          1. Generalities of the Timeout Pattern
            1. Details of the Timeout Pattern
            2. Motivations for Using the Timeout Pattern
            3. Terminating a Browser Session
          2. A Timeout Pattern Reference Implementation
            1. A Sample Scenario for the Timeout Pattern
            2. Open Points Regarding the Timeout Pattern
          3. Related Patterns
            1. The Periodic Refresh Pattern
            2. The Heartbeat Pattern
            3. The Event Scheduling Pattern
        5. The Progress Indicator Pattern
          1. Generalities of the Progress Indicator Pattern
            1. Details of the Progress Indicator Pattern
            2. The ASP.NET UpdateProgress Control
            3. Open Points Regarding the Progress Indicator Pattern
          2. A Progress Indicator Reference Implementation
            1. A Sample Scenario for the Progress Indicator Pattern
            2. Definition of the Server API
            3. Implementing the Task
            4. Definition of the Event Sink
            5. Definition of the Client API
            6. Updating the User Interface
          3. Canceling an Ongoing Remote Task
            1. The Too-Easy Way of Canceling Tasks
            2. Designing an Interruptible Server Task
            3. Interrupting a Task from the Client
            4. What About Rollbacks?
        6. Other Patterns
          1. The Micro-Link Pattern
            1. Page Links and Micro-Links
            2. Micro-Links in Action
            3. Micro-Links in jQuery
          2. The Cross-Domain Proxy Pattern
            1. The Same Origin Policy Problem
            2. Web Remoting via JavaScript
            3. Handling Errors
          3. The Submission Throttling Pattern
            1. The Explicit Submission Pattern
            2. Piecemeal Submission
            3. Timers to Simulate Multithreading
            4. The Live Form Pattern
        7. Summary
      4. 7. Client-Side Data Binding
        1. An Architectural Tour of ASP.NET Data Binding
          1. Defining the HTML Template
            1. Automated HTML Factories
            2. Template-Based HTML Factories
            3. The ITemplate Interface
            4. Template-Based Approach vs. Automated Approach
          2. Defining the Data Source
            1. Feasible Data Sources in ASP.NET
            2. Data Binding Properties
          3. Data Binding at the Time of AJAX
            1. Tools for Effective Client-Side Data Binding
            2. Partial Rendering Is Still an Option
        2. The Browser-Side Template Pattern
          1. Generalities of the BST Pattern
            1. The BST Pattern Explained
            2. What’s an HTML Template Exactly?
            3. Mixing Data and Templates
            4. Dual-Side Templating
          2. Creating a BST Reference Implementation
            1. BST: The Big Picture
            2. Preparing the Page
            3. The HTML Builder
            4. Customized Item Rendering
            5. Customized Markup Rendering
            6. Making Your Solution Juicier with jQuery Effects
        3. The HTML Message Pattern
          1. Generalities of the HM Pattern
            1. The HM Pattern Explained
            2. Motivation for Using the HM Pattern
            3. BST vs. HTML Message
          2. Developing an HM Reference Implementation
            1. HM: The Big Picture
            2. The Remote Service
            3. Markup Rendering
            4. The DynamicPopulate Extender
            5. A Quick Demo in ASP.NET MVC
        4. A Look at ASP.NET AJAX 4.0
          1. ASP.NET AJAX Templates
            1. Structure of a Template
            2. The Sys.UI.DataView Component
            3. Injecting Logic into the Template
            4. The Sys.Data.DataSource Component
          2. ASP.NET Library for ADO.NET Data Services
            1. Generalities of the ADO.NET Data Services Framework
            2. Using a Proxy for ADO.NET Data Services
            3. Displaying Content from an ADO.NET Data Service
        5. Summary
      5. 8. Rich Internet Applications
        1. Looking for a Richer Web
          1. The Dream of Binary Code Running over the Web
            1. The Initial ActiveX Attempt
            2. The Thorns of Security and Interoperability
            3. The Flash Attempt
          2. Browser Plug-ins
            1. A Brief History of Plug-ins
            2. Security Concerns
            3. The <object> Tag
            4. Characteristics of a Browser Plug-in
            5. Plug-ins for Hosting Applications
        2. Microsoft Silverlight at a Glance
          1. Elements of the Silverlight Architecture
            1. Silverlight vs. AJAX
            2. Silverlight vs. Smart Clients
            3. Running Silverlight Applications
          2. Graphics and Multimedia
            1. Media Pack
            2. Animation
            3. Deep Zoom
          3. Building Applications
            1. Code and Markup
            2. Programming Languages
            3. XAP Packages
            4. CLR Instancing
        3. The Programming Model of Microsoft Silverlight
          1. WPF-Based User Interface
            1. Layout Manager
            2. Common Controls
            3. The Data Binding Manager
            4. Compatibility Between Silverlight and WPF Code
          2. The .NET Base Class Library
            1. Support for LINQ
            2. Support for Threads
            3. Support for Timers
          3. Isolated Storage
            1. Why Is Local Storage Important?
            2. The Storage System
            3. Working with Files and Directories
            4. Working with File Streams
            5. Storage Management
            6. Disk Quotas
          4. Networking
            1. Downloading Data
            2. Managing Web Requests
            3. Consuming Services
            4. Cross-Domain Requests
        4. Microsoft Silverlight and Code Security
          1. The Security Model
            1. Code Access Security
            2. Code Transparency
          2. Security Attributes
            1. Transparent Code
            2. Critical Code
            3. Safe-Critical Code
          3. Secure by Design
            1. Application Code vs. Platform Code
            2. Inheritance Rules
        5. Summary
      6. About the Author
    6. Index
    7. SPECIAL OFFER: Upgrade this ebook with O’Reilly

Product information

  • Title: Microsoft® ASP.NET and AJAX: Architecting Web Applications
  • Author(s): Dino Esposito
  • Release date: April 2009
  • Publisher(s): Microsoft Press
  • ISBN: 9780735626218