You are previewing ASP.NET in a Nutshell, Second Edition.
O'Reilly logo
ASP.NET in a Nutshell, Second Edition

Book Description

ASP.NET in a Nutshell is a concise, one-volume reference to everything you need to make effective use of ASP.NET. An invaluable resource that goes beyond the published documentation to highlight little-known details, stress practical uses for particular features, and provide real-world examples that show how features can be used in a working application, ASP.NET in a Nutshell is the definitive guide for developers of both applications and web services. Updated for Visual Studio .NET 2003, the 2nd edition of this book includes fresh information on application and web service development, custom controls, data access, security, deployment, and error handling, new material on web application development for mobile devices, plus an overview of the class libraries. For developers who still use Microsoft's older ASP technology, this book also provides information for migrating to ASP.NET. The material in ASP.NET in a Nutshell is presented in three sections:

  • A fast-paced introduction to ASP.NET that examines topics such as building ASP.NET applications, developing web services, creating custom controls and user controls for maximum code reuse, debugging and handling errors, understanding ASP.NET security, and configuring and deploying an ASP.NET application

  • A detailed reference to the properties, methods, and events of the most frequently used ASP.NET classes which include the Page class and the new .NET classes, such as HttpApplicationState and HttpSessionState, which correspond to the intrinsic objects in classic ASP. Configuration settings in web.config are also documented

  • A Quick Reference to the types (the classes, structures, interfaces, delegates, events, and enumerations) found in web-related namespaces to the .NET Framework Class Library.

Like other books in the "In a Nutshell" series, ASP.NET in a Nutshell, 2nd Edition, offers the facts, including critical background information, in a no-nonsense manner that users will refer to again and again. With its wealth of up-to-date information, ASP.NET in a Nutshell is a book that web developers will refer to again and again.

Table of Contents

  1. Table of Contents
  2. Preface
    1. Who Is This Book for?
    2. How to Use This Book
    3. How This Book Is Structured
    4. Conventions Used in This Book
    5. How to Contact Us
    6. Acknowledgments
  3. I
  4. Introduction
    1. .NET Platform Fundamentals
      1. The Common Language Runtime (CLR)
      2. The .NET Framework Class Library (FCL)
      3. The Common Type System (CTS)
        1. Boxing and unboxing
      4. The Common Language Infrastructure (CLI)
      5. The Common Language Specification (CLS)
      6. Classes
      7. Namespaces
      8. Assemblies
      9. Intermediate Language (IL)
      10. Managed Execution
      11. Manifests, Metadata, and Attributes
    2. Object Orientation in the .NET Platform
      1. Why Is It Important? Rapid Development and Reuse!
      2. OO Is at the Heart of Every ASP.NET Page
    3. Choosing a Language
    4. Why and When Would I Use ASP.NET?
    5. Why and When Would I Port an Existing Application to ASP.NET?
    6. New Features in ASP.NET
      1. New Features in ASP.NET v1.1
  5. ASP.NET Applications
    1. Application Types
      1. ASP.NET Web Applications
        1. ASP.NET Mobile Web Applications
      2. ASP.NET Web Services
    2. Application Structure and Boundaries
      1. Application Structure
      2. Application Boundaries
      3. Request Lifecycle and Handling
    3. Application File Types
      1. web.config Files
      2. global.asax Files
      3. .aspx Files
      4. .asmx Files
      5. .ascx Files
      6. Code-Behind and Class Files
        1. .vb extension
        2. .cs extension
  6. Web Forms
    1. Structuring an ASP.NET Page
      1. Using @ Directives
      2. Combining User Interface and Code
      3. Code-Behind Files
    2. Stages of Page Processing
      1. Handling Events
        1. Automatic event wiring
        2. Using AddHandler or += to wire events
        3. Using the WithEvents and Handles keywords to wire events
      2. ASP.NET Page and Control Events
        1. Init
        2. Load
        3. DataBinding
        4. Control events
        5. PreRender
        6. Unload
    3. State Management
    4. Caching Page Output
    5. Additional Resources
  7. Web Services
    1. Standards and Specifications
    2. Web Services Architecture
    3. Creating a Web Service
      1. Web Service with Inline Code
      2. Web Service Using Code-Behind
      3. Inheriting from WebService
      4. Discovery Documents
      5. Publishing and Locating Web Services
      6. UDDI
    4. Consuming a Web Service
    5. Additional Resources
  8. ASP.NET Server Controls
    1. HTML Controls
    2. Web Controls
    3. Using Controls
      1. Declarative Control Use
      2. Programmatic Control Use
    4. Types of Web Controls
      1. Input Controls
      2. Display Controls
      3. Action Controls
      4. Selection Controls
      5. Databound Controls
      6. Rich Controls
      7. Validation Controls
      8. Mobile Controls
    5. Handling Control Events
      1. Wiring Up Events in Declarative Tags
      2. Wiring Up Events Programmatically
    6. Modifying Control Appearance
      1. Properties
      2. CSS Styles
      3. Templates
    7. Additional Resources
  9. User Controls and Custom Server Controls
    1. User Controls
    2. Custom Server Controls
      1. Rendered Controls
      2. Compositional Controls
      3. Adding Design-Time Support
        1. Metadata attributes
        2. Adding a control designer
        3. Custom schemas and Visual Studio annotations
      4. Adding Client Script
    3. Sharing Controls Across Applications
    4. Additional Resources
  10. Data Access and Data Binding
    1. ADO.NET: An Overview
    2. Reading Data
      1. Reading from a Database
        1. Using a data reader
        2. Dataset and data adapter
      2. Reading from XML
    3. Data Binding
      1. Binding to Properties
      2. Binding to Collections
      3. Binding to DataViews
    4. Inserting and Updating Data
    5. Deleting Data
    6. Additional Resources
  11. ASP.NET Configuration
    1. Understanding Configuration Files
    2. Modifying Configuration Settings
      1. Modifying Trace Settings
      2. Changing the Authentication Mode
      3. Configuring Out-of-Process Session State
    3. Locking Down Configuration Settings
    4. Targeting a Specific Runtime Version
    5. Additional Resources
  12. ASP.NET Security
    1. Authentication Methods
      1. Windows Authentication
        1. Impersonation
      2. Forms Authentication
        1. Logging in
        2. Logging out
      3. Passport Authentication
    2. Authorization
      1. ACL-Based Authorization
      2. URL Authorization
      3. Programmatic Authorization
    3. Ensuring Input Safety
      1. Request Validation
      2. Other Filtering/Prevention Techniques
        1. Regular expressions
        2. HTML encoding
      3. SQL Injection
    4. Patching
    5. Code Access Security
    6. Additional Resources
  13. Error Handling, Debugging, and Tracing
    1. Error Handling
      1. Custom Error Pages
      2. Page_Error and Application_Error
      3. Structured Exception Handling
    2. Debugging
      1. Using the SDK Debugger
      2. Using the Visual Studio .NET Debugger
    3. Tracing
      1. Page-Level Tracing
      2. Application-Level Tracing
      3. Using Trace.Write and Trace.Warn
    4. Additional Resources
  14. ASP.NET Deployment
    1. Deploying ASP.NET Applications
    2. Deploying Assemblies
      1. Deploying Application-Specific Assemblies
      2. Deploying Global Assemblies
    3. Deploying Through Visual Studio .NET
      1. Deploying Using Copy Project
      2. Deploying Using a Web Setup Project
    4. Additional Resources
  15. II
  16. The Page Class
    1. Comments/Troubleshooting
    2. Properties Reference
      1. Application
      2. Cache
      3. ClientTarget
      4. Context
      5. EnableViewState
      6. ErrorPage
      7. IsPostBack
      8. IsValid
      9. Request
      10. Response
      11. Server
      12. Session
      13. SmartNavigation
      14. Trace
      15. User
      16. ViewState
      17. ViewStateUserKey
    3. Collections Reference
      1. Controls
      2. Validators
    4. Methods Reference
      1. DataBind
      2. FindControl
      3. HasControls
      4. LoadControl
      5. MapPath
      6. ResolveUrl
      7. Validate
    5. Events Reference
      1. Error
      2. Init
      3. Load
      4. Unload
  17. The HttpApplicationState Class
    1. Comments/Troubleshooting
    2. Properties Reference
      1. Count
      2. Item
    3. Collections Reference
      1. AllKeys
      2. Contents
      3. Keys
      4. StaticObjects
    4. Methods Reference
      1. Add
      2. Clear
      3. Get
      4. GetKey
      5. Lock
      6. Remove
      7. RemoveAll
      8. RemoveAt
      9. Set
      10. UnLock
    5. Events Reference
      1. Start
      2. End
  18. The HttpContext Class
    1. Comments/Troubleshooting
    2. Properties Reference
      1. Application
      2. ApplicationInstance
      3. Cache
      4. Current
      5. Error
      6. Handler
      7. IsCustomErrorEnabled
      8. IsDebuggingEnabled
      9. Request
      10. Response
      11. Session
      12. SkipAuthorization
      13. Timestamp
      14. Trace
      15. User
    3. Collections Reference
      1. AllErrors
      2. Items
    4. Methods Reference
      1. AddError
      2. ClearError
      3. GetAppConfig
      4. GetConfig
      5. RewritePath
  19. The HttpException Class
    1. Comments/Troubleshooting
    2. Constructor Reference
    3. Properties Reference
      1. ErrorCode
      2. HelpLink
      3. InnerException
      4. Message
      5. Source
      6. StackTrace
      7. TargetSite
    4. Methods Reference
      1. GetBaseException
      2. GetHtmlErrorMessage
      3. GetHttpCode
      4. ToString
  20. The HttpRequest Class
    1. Comments/Troubleshooting
    2. Properties Reference
      1. AcceptTypes
      2. ApplicationPath
      3. Browser
      4. ClientCertificate
      5. ContentEncoding
      6. ContentLength
      7. ContentType
      8. FilePath
      9. HttpMethod
      10. InputStream
      11. IsAuthenticated
      12. IsSecureConnection
      13. Path
      14. PathInfo
      15. PhysicalApplicationPath
      16. PhysicalPath
      17. RawUrl
      18. RequestType
      19. TotalBytes
      20. Url
      21. UrlReferrer
      22. UserAgent
      23. UserHostAddress
      24. UserHostName
      25. UserLanguages
    3. Collections Reference
      1. Cookies
      2. Files
      3. Form
      4. Headers
      5. Params
      6. QueryString
      7. ServerVariables
    4. Methods Reference
      1. BinaryRead
      2. MapPath
      3. SaveAs
  21. The HttpResponse Class
    1. Comments/Troubleshooting
    2. Properties Reference
      1. Buffer
      2. BufferOutput
      3. Cache
      4. CacheControl
      5. Charset
      6. ContentEncoding
      7. ContentType
      8. Expires
      9. ExpiresAbsolute
      10. IsClientConnected
      11. Output
      12. OutputStream
      13. Status
      14. StatusCode
      15. StatusDescription
      16. SuppressContent
    3. Collections Reference
      1. Cookies
    4. Methods Reference
      1. AddCacheItemDependencies
      2. AddCacheItemDependency
      3. AddFileDependencies
      4. AddFileDependency
      5. AddHeader
      6. AppendHeader
      7. AppendToLog
      8. ApplyAppPathModifier
      9. BinaryWrite
      10. Clear
      11. ClearContent
      12. ClearHeaders
      13. Close
      14. End
      15. Flush
      16. Pics
      17. Redirect
      18. Write
      19. WriteFile
  22. The HttpServerUtility Class
    1. Comments/Troubleshooting
    2. Properties Reference
      1. MachineName
      2. ScriptTimeout
    3. Methods Reference
      1. ClearError
      2. CreateObject
      3. CreateObjectFromClsid
      4. Execute
      5. GetLastError
      6. HtmlDecode
      7. HtmlEncode
      8. MapPath
      9. Transfer
      10. UrlDecode
      11. UrlEncode
      12. UrlPathEncode
  23. The HttpSessionState Class
    1. Comments/Troubleshooting
    2. Properties Reference
      1. CodePage
      2. Count
      3. IsCookieless
      4. IsNewSession
      5. IsReadOnly
      6. Item
      7. LCID
      8. Mode
      9. SessionID
      10. Timeout
    3. Collections Reference
      1. Contents
      2. Keys
      3. StaticObjects
    4. Methods Reference
      1. Abandon
      2. Add
      3. Clear
      4. CopyTo
      5. Remove
      6. RemoveAll
      7. RemoveAt
    5. Events Reference
      1. Start
      2. End
  24. web.config Reference
    1. Comments/Troubleshooting
    2. web.config Elements
      1. <configuration>
      2. <appSettings>
      3. <system.web>
      4. <authentication>
      5. <forms>
      6. <credentials>
      7. <user>
      8. <passport>
      9. <authorization>
      10. <allow>
      11. <deny>
      12. <browserCaps>
      13. <result>
      14. <use>
      15. <filter>
      16. <case>
      17. <clientTarget>
      18. <compilation>
      19. <assemblies>
      20. <compilers>
      21. <compiler>
      22. <customErrors>
      23. <error>
      24. <globalization>
      25. <httpHandlers>
      26. <httpModules>
      27. <httpRuntime>
      28. <identity>
      29. <machineKey>
      30. <pages>
      31. <processModel>
      32. <securityPolicy>
      33. <sessionState>
      34. <trace>
      35. <trust>
      36. <location>
  25. III
  26. Namespace Reference
    1. Reading a Quick-Reference Entry
      1. Type Name, Namespace, Assembly, Type Category, and Flags
      2. Description
      3. Synopsis
        1. Member availability and flags
        2. Functional grouping of members
      4. Class Hierarchy
      5. Cross References
      6. A Note About Type Names