You are previewing Microsoft® ASP.NET 2.0 Step By Step.
O'Reilly logo
Microsoft® ASP.NET 2.0 Step By Step

Book Description

The Web application infrastructure ASP.NET, introduced as part of version 1.0 of the Microsoft .NET Framework, provides the thin-client counterpart to Microsoft Windows® client development. With dramatic improvements in performance, productivity, and security features, Microsoft Visual Studio® 2005 and ASP.NET 2.0 deliver a simplified, high-performance, and powerful Web development experience. ASP.NET 2.0 features a new set of controls and infrastructure that simplify Web-based data access and include functionality that facilitates code reuse, visual consistency, and aesthetic appeal. Now you can teach yourself the essentials of working with ASP.NET 2.0 in the Visual Studio environment—one step at a time. With STEP BY STEP, you work at your own pace through hands-on, learn-by-doing exercises. Whether you’re a beginning programmer or new to this version of the technology, you’ll understand the core capabilities and fundamental techniques for ASP.NET 2.0. Each chapter puts you to work, showing you how, when, and why to use specific features of the ASP.NET 2.0 rapid application development environment and guiding you as you create actual components and working applications for the Web, including advanced features such as personalization.

Table of Contents

  1. Microsoft® ASP.NET 2.0: Step by Step
  2. Dedication
  3. A Note Regarding Supplemental Files
  4. Introduction
    1. The Road to ASP.NET 2.0
    2. Classic ASP
    3. ASP.NET 1.0 and 1.1
    4. ASP.NET 2.0
    5. A Word About the .NET Runtime
    6. Using This Book
    7. Who Is This Book For?
    8. Organization of This Book
    9. Getting Started
    10. Finding Your Best Starting Point in This Book
    11. Conventions and Features in This Book
      1. Conventions
      2. Other Features
    12. System Requirements
    13. Using Microsoft Access
    14. Code Samples
      1. Installing the C# Code Samples
      2. Installing the Visual Basic Code Samples
      3. Using the Code Samples
      4. Uninstalling the Code Samples
    15. Prerelease Software
    16. Online Companion Content
    17. Support for This Book
      1. Questions and Comments
  5. Acknowledgments
  6. 1. Web Application Basics
    1. HTTP Requests
      1. HTTP Requests from a Browser
      2. Making HTTP Requests Without a Browser
        1. Build a Simple HTTP Requestor
    2. HyperText Markup Language (HTML)
    3. Dynamic Content
      1. HTML Forms
      2. Common Gateway Interface
      3. The Microsoft Platform as a Web Server
    4. Internet Information Services
      1. Internet Services Application Programming Interface DLLs
      2. Internet Information Services
        1. Running IIS
    5. Classic ASP
    6. Web Development Issues
    7. ASP.NET
    8. Chapter 1 Quick Reference
  7. 2. ASP.NET Application Fundamentals
    1. The Canonical Hello World Application
      1. Building the HelloWorld Web Application
      2. Mixing HTML with Executable Code
        1. Adding Executable Code Inline
      3. Server-Side Executable Blocks
        1. Adding Executable Code via a Script Block
    2. The ASP.NET Compilation Model
      1. Viewing the ASP.NET Assemblies
    3. Coding Options
      1. ASP.NET 1.x Style
      2. ASP.NET 2.x Style
    4. The ASP.NET Pipeline
      1. Request Path
        1. The HttpApplication
        2. The HttpContext
        3. HttpModules
        4. HttpHandlers
    5. Visual Studio and ASP.NET
      1. Kinds of Web Sites
        1. Local IIS Web Sites
        2. File System Web Sites
        3. FTP Web Sites
        4. Remote Web Sites
        5. Hello World and Visual Studio
    6. Conclusion
    7. Chapter 2 Quick Reference
  8. 3. The Page Rendering Model
    1. Rendering Controls as Tags
    2. Packaging UI as Components
      1. The Page Using ASP.NET
      2. The Page’s Rendering Model
      3. The Page’s Control Tree
    3. Adding Controls Using Visual Studio
      1. Building a Page with Visual Studio
      2. Layout Considerations
    4. Conclusion
    5. Chapter 3 Quick Reference
  9. 4. Custom Rendered Controls
    1. The Control Class
    2. Visual Studio and Custom Controls
      1. Create a Custom Control
    3. A Palindrome Checker
      1. The Palindrome Checker Control
    4. Controls and Events
      1. Adding a PalindromeFound Event
    5. HtmlTextWriter and Controls
      1. Use the HtmlTextWriter
    6. Controls and View State
      1. Using View State
    7. Conclusion
    8. Chapter 4 Quick Reference
  10. 5. Composite Controls
    1. Composite Controls versus Rendered Controls
    2. Custom Composite Controls
      1. The Palindrome Checker as a Composite Custom Control
    3. User Controls
      1. The Palindrome Checker as a User Control
    4. When to Use Each Type of Control
    5. Conclusion
    6. Chapter 5 Quick Reference
  11. 6. Control Potpourri
    1. Validation
      1. Creating a page that employs validation controls
      2. How Page Validation Works
        1. Client-Side Validation
        2. Server-Side Validation
          1. Add Finer-grained Validation
      3. Other Validators
      4. Validator Properties
    2. TreeView
      1. Using the TreeView control
    3. MultiView
      1. Using the MultiView and View controls
    4. Conclusion
    5. Chapter 6 Quick Reference
  12. 7. Web Parts
    1. A Brief History of Web Parts
    2. What Good Are Web Parts?
      1. Developing Web Parts Controls
      2. Web Parts Page Development
      3. Web Parts Application Development
    3. The Web Parts Architecture
      1. WebPartManager and WebZones
      2. Built-in Zones
      3. Built-in Web Parts
        1. Using Web Parts
    4. Developing a Web Part
      1. Developing the HyperLinkWebPart
    5. Conclusion
    6. Chapter 7 Quick Reference
  13. 8. A Common Look and Feel
    1. A Common Look and Feel
    2. ASP.NET 2.0 Master Pages
      1. Using a Master Page
    3. Themes
      1. Creating and Using a Theme
    4. Skins
      1. Create a Skin
    5. Conclusion
    6. Chapter 8 Quick Reference
  14. 9. Configuration
    1. Windows Configuration
    2. .NET Configuration
      1. Machine.Config
      2. Configuration Section Handlers
      3. Web.Config
      4. Configuration in ASP.NET 1.x
      5. Configuration in ASP.NET 2.0
        1. Configuring Your Application
      6. The ASP.NET Administration Tool
    3. ASP.NET MMC Snap-in
      1. Use the MMC Snap-in
    4. Conclusion
    5. Chapter 9 Quick Reference
  15. 10. Logging In
    1. Web-Based Security
      1. Securing IIS
    2. Basic Forms Authentication
      1. Run the Forms Authentication Example
    3. ASP.NET Authentication Services
      1. The FormsAuthentication Class
      2. An Optional Login Page
        1. Run the Optional Login Page
    4. Managing Users
      1. Managing User Access
    5. ASP.NET Login Controls
      1. Write a Login Page
    6. Authorizing Users
      1. Managing Authorization
    7. Conclusion
    8. Chapter 10 Quick Reference
  16. 11. Databinding
    1. Representing Collections without Databinding
    2. Representing Collections with Databinding
      1. ListControl-Based Controls
      2. TreeView
      3. Menu
      4. FormView
      5. GridView
      6. DetailsView
      7. DataList
      8. Repeater
    3. Simple Databinding
      1. Databinding with an ArrayList
    4. Accessing Databases
    5. The .NET Database Story
      1. Connections
      2. Commands
      3. Managing Results
        1. DataReader
        2. DataSet
    6. ASP.NET Data Sources
      1. Use a DataSource to Populate Controls in DataReader Mode
    7. Other Databound Controls
      1. The GridView
      2. The FormView
      3. The DetailsView
      4. The DataList
    8. Conclusion
    9. Chapter 11 Quick Reference
  17. 12. Personalization
    1. Personalizing Web Visits
    2. Personalization in ASP.NET
      1. User Profiles
      2. Personalization Providers
    3. Using Personalization
      1. Defining Profiles in Web.Config
      2. Use Profile Information
      3. Saving Profile Changes
      4. Profiles and Users
        1. Using Profiles
    4. Conclusion
    5. Chapter 12 Quick Reference
  18. 13. Session State
    1. Why Session State?
    2. ASP.NET and Session State
    3. Getting a Taste of Session State
      1. Trying Session State
    4. Session State and More Complex Data
      1. Session State, ADO.NET Objects, and Databound Controls
    5. Configuring Session State
      1. Turning Off Session State
      2. Storing Session State InProc
      3. Storing Session State in a State Server
      4. Storing Session State in a Database
    6. Tracking Session State
      1. Tracking Session State with Cookies
      2. Tracking Session State with the URL
      3. Using AutoDetect
      4. Applying Device Profiles
      5. Session State Timeouts
    7. Other Session Configuration Settings
    8. The Wizard Control: Alternative to Session State
      1. Using the Wizard Control
    9. Conclusion
    10. Chapter 13 Quick Reference
  19. 14. Application Data Caching
    1. Making an Application that Benefits from Caching
    2. Using the Data Cache
      1. Using the Cache
      2. Impact of Caching
    3. Managing the Cache
      1. DataSets in Memory
      2. Cache Expirations
        1. Absolute Expiration
        2. Sliding Expirations
      3. Cache Dependencies
        1. Setting Cache Dependencies
      4. The SQL Server Dependency
      5. Clearing the Cache
        1. Removal Callback
    4. Conclusion
    5. Chapter 14 Quick Reference
  20. 15. Caching Output
    1. Caching Content
      1. Create a Cacheable Page
    2. Managing Cached Content
      1. Modifying the OutputCache Directive
        1. Varying Cached Content by Query String Parameters
      2. The HttpCachePolicy
      3. Caching Locations
      4. Output Cache Dependencies
      5. Caching Profiles
        1. Set Up a Cache Profile
    3. Caching User Controls
      1. User Controls and Output Caching
    4. When Output Caching Makes Sense
    5. Conclusion
    6. Chapter 15 Quick Reference
  21. 16. Diagnostics and Debugging
    1. Page Tracing
      1. Turning on Tracing
      2. Trace Statements
        1. Adding Tracing Statements
    2. Application Tracing
      1. Application-level Tracing
      2. Enabling Tracing Programmatically
      3. The TraceFinished Event
      4. Piping Other Trace Messages
    3. Debugging with Visual Studio
      1. Debug an Application
    4. Error Pages
      1. Work with Error Pages
    5. Unhandled Exceptions
    6. Conclusion
    7. Chapter 16 Quick Reference
  22. 17. The Application and HTTP Modules
    1. The Application: A Rendezvous Point
    2. Overriding HttpApplication
      1. Managing Application State
      2. Application State Caveats
      3. Handling Events
        1. Application_Start
        2. Application_End
        3. Application_Error
        4. Session_Start
        5. Session_End
      4. HttpApplication Events
        1. Timing Requests
    3. HttpModules
      1. Existing Modules
      2. Implementing a Module
        1. A Timing Module
      3. See Active Modules
        1. Listing the Modules
      4. Storing State in Modules
        1. Tracking Average Request Duration
    4. Global.asax versus HttpModules
    5. Conclusion
    6. Chapter 17 Quick Reference
  23. 18. Custom Handlers
    1. Handlers
    2. Built-in Handlers
    3. IHttpHandler
    4. Implementing IHttpHandler
      1. Writing a Custom Handler
      2. The CustomFormHandler Using VB
    5. Handlers and Session State
    6. Generic Handlers (ASHX Files)
      1. Writing a Generic Handler
    7. Conclusion
    8. Chapter 18 Quick Reference
  24. 19. Web Services
    1. Remoting
    2. Remoting Over the Web
      1. Simple Object Access Protocol (SOAP)
      2. Transporting the Type System
      3. Web Service Description Language
    3. If You Couldn’t Use ASP.NET...
    4. A Web Service in ASP.NET
      1. Write an ASP.NET Web Service
    5. Consuming Web Services
      1. Use the QuoteService
    6. Asynchronous Execution
    7. Web Services in Visual Basic
    8. What Good Are Web Services?
    9. Other Features
    10. Conclusion
    11. Chapter 19 Quick Reference
  25. 20. Managing and Deploying Web Applications
    1. Visual Studio Projects
      1. HTTP Project
      2. FTP Project
      3. File System Project
    2. Precompiling
      1. Precompiling for Performance
      2. Precompiling for Deployment
        1. Creating a Web Site Installer
    3. Conclusion
    4. Chapter 20 Quick Reference
  26. A. George Shepherd
  27. Index
  28. About the Author
  29. Copyright