Programming Microsoft® .NET

Book description

Learn how to develop robust, Web-enabled and Microsoft Windows-based applications by taking advantage of C# and the Microsoft .NET Framework

The Microsoft .NET initiative builds on industry standards to make interoperable software services available anywhere, on any device, over the Internet. Behind the initiative is the Microsoft .NET Framework, which combines a managed run-time environment with one of the richest class libraries ever invented to make building and deploying Web-enabled applications easier than ever. Find out how to leverage the full power of the .NET Framework with this definitive, one-stop resource, written by a leading authority in his trademark easy-to-follow, conversational style. You'll learn about the key programming models embodied in the .NET Framework, including Windows® Forms, Web Forms, and XML Web services. And you'll benefit from a wealth of how-to examples, code samples, and complete working programs in C#.

Table of contents

  1. Dedication
  2. Acknowledgments
  3. Introduction
    1. The Journey Ahead
    2. A Word About Programming Languages
    3. System Requirements
    4. What’s on the CD
    5. Support
    6. Blogs and Other Things That Go Bump in the Night
  4. I. Essential Concepts
    1. 1. Hello, .NET
      1. The Microsoft .NET Initiative
      2. The Microsoft .NET Framework
        1. The Common Language Runtime
      3. Programming Languages
      4. Managed Modules
      5. Metadata
        1. Common Intermediate Language
        2. Assemblies
        3. The .NET Framework Class Library
      6. Your First .NET Framework Application
        1. Hello, World
        2. Inside Hello.cs
        3. More About the Main Method
        4. Inside Hello.exe
      7. The Big Picture
    2. 2. Types and Exceptions
      1. .NET Framework Data Types
        1. Classes
        2. Structs
        3. Interfaces
        4. Enumerations
        5. Delegates
        6. Boxing and Unboxing
        7. Reference Types vs. Value Types
        8. Nondeterministic Destruction
      2. Dynamic Linking
        1. Creating a Multifile Assembly
        2. Dynamically Linking to an Assembly
        3. Versioning an Assembly
        4. Sharing an Assembly: The Global Assembly Cache
        5. Applying Strong Names Using Attributes
      3. Delayed Signing
      4. Exception Handling
        1. Catching Exceptions
        2. Guaranteeing Execution
        3. Throwing Exceptions
      5. Next Up: The .NET Framework Class Library
    3. 3. The .NET Framework Class Library
      1. File and Stream I/O
        1. Text File I/O
        2. Binary File I/O
      2. Collections
        1. Hash Tables
        2. Resizable Arrays
        3. The WordCount Application
      3. Regular Expressions
        1. Splitting Strings
        2. Searching Strings
        3. Replacing Strings
      4. Internet Classes
        1. HttpWebRequest and HttpWebResponse
        2. The System.Web.Mail Namespace
      5. Data Access
        1. DataReaders
        2. Inserts, Updates, and Deletes
        3. DataSets and DataAdapters
      6. Reflection
        1. Retrieving Information About Assemblies, Modules, and Types
        2. Custom Attributes
        3. Dynamically Loading Types (Late Binding)
      7. The FCL in Review
    4. 4. Windows Forms
      1. The Windows Forms Programming Model
        1. Your First Windows Form
        2. Drawing in a Form: The GDI+
          1. Drawing Lines, Curves, and Figures
          2. Disposing of GDI+ Objects
          3. Coordinates and Transformations
          4. Units of Measure
        3. Menus
          1. Main Menus
          2. Processing Menu Commands
          3. Context Menus
          4. Menu Item States
          5. Accelerators
          6. The ImageView Application
        4. Mouse and Keyboard Input
          1. Processing Keyboard Input
          2. Processing Mouse Input
          3. The NetDraw Application
          4. Other Form-Level Events
      2. Controls
        1. The ControlDemo Application
        2. Anchoring
      3. Dialog Boxes
        1. The DialogDemo Application
      4. Windows Forms and Visual Studio .NET
        1. Step 1: Create a Project
        2. Step 2: Design the Form
        3. Step 3: Add Fields
        4. Step 4: Modify the Form’s Class Constructor
        5. Step 5: Add Helper Methods
        6. Step 6: Add Click Handlers
        7. Step 7: Add Keyboard Handlers
        8. Step 8: Override ProcessDialogKey
        9. Step 9: Build and Run the Application
        10. The NetCalc Source Code
      5. Windows Forms Retrospective
  5. II. ASP.NET
    1. 5. Web Forms
      1. Web Application Primer
        1. Hypertext Transfer Protocol
        2. HTML Forms
        3. Server-Side Processing
        4. The Active Server Pages Solution
        5. Your First Web Form
          1. Control Properties
          2. Control Events
          3. Implementation Notes
      2. The Web Forms Programming Model
        1. Web Controls
        2. HTML Controls
        3. Page-Level Events
          1. The Page.Load Event and the Page.IsPostBack Property
          2. The Page.Init Event
        4. Page-Level Directives
          1. The @ Page Directive
          2. The @ Import Directive
          3. The @ Assembly Directive
          4. The @ OutputCache Directive
        5. A Web Forms Currency Converter
      3. Code-Behind Programming
        1. The Lander Application
        2. How Code-Behind Works
        3. Using Code-Behind Without Precompiling: The Src Attribute
        4. Using Non-ASP.NET Languages in ASP.NET Web Forms
      4. Web Forms and Visual Studio .NET
        1. Step 1: Create a Virtual Directory
        2. Step 2: Create a Web Application Project
        3. Step 3: Change to Flow Layout Mode
        4. Step 4: Add a Table
        5. Step 5: Insert Text
        6. Step 6: Add TextBox Controls
        7. Step 7: Add a Button Control
        8. Step 8: Add a Label Control
        9. Step 9: Edit the HTML
        10. Step 10: Add a Click Handler
        11. Step 11: Build and Test
        12. The LoanCalc Source Code
      5. A Glimpse into the Future
    2. 6. Web Controls
      1. Simple Controls
        1. TextBox Controls
          1. TextChanged Events and the AutoPostBack Property
        2. Label Controls
        3. HyperLink Controls
        4. Image Controls
        5. CheckBox Controls
        6. RadioButton Controls
        7. Table Controls
        8. Panel Controls
      2. Button Controls
      3. List Controls
        1. DropDownList Controls
        2. ListBox Controls
        3. CheckBoxList Controls
        4. RadioButtonList Controls
        5. Data Binding with List Controls
      4. Data-Bound Controls
        1. Repeater Controls
        2. The MyComicsRepeater Page
        3. DataList Controls
        4. The MyComicsDataList Page
        5. DataGrid Controls
          1. Sortable DataGrid Controls
          2. Pageable DataGrid Controls
        6. The MyComicsDataGrid Page
      5. Calendar Controls
        1. Advanced Customization: The DayRender Event
        2. Showtime
      6. Validation Controls
        1. Using the Validation Controls
        2. RequiredFieldValidator
        3. RangeValidator
        4. CompareValidator
        5. RegularExpressionValidator
        6. CustomValidator
        7. ValidationSummary
        8. Spammers, Incorporated
          1. Connecting Web Forms with Response.Redirect
          2. The StringBuilder Class
        9. Conditional Validation
      7. Odds, Ends, and the WebControl Base Class
    3. 7. User Controls
      1. User Control Fundamentals
        1. The @ Control Directive
        2. Your First User Control
        3. Adding Properties
        4. Adding Events
        5. Using Code-Behind with User Controls
      2. The XmlNavBar Control
      3. Dynamic Loading (and Cookies, Too!)
        1. Cookies
        2. Cookies and ASP.NET
          1. Multivalue Cookies
        3. The MyQuotes Page
      4. Fragment Caching
      5. Next Up: Custom Controls
    4. 8. Custom Controls
      1. Custom Control Basics
        1. Your First Custom Control
        2. Testing the Hello Control
        3. Improving the Hello Control: Adding Properties
        4. More About HtmlTextWriter
      2. Postbacks and Postback Data
        1. The IPostBackDataHandler Interface
        2. View State
        3. Change Events
        4. How View State Works
          1. View State Security
        5. Generating Postbacks
        6. The IPostBackEventHandler Interface
        7. The AutoCounter Control
      3. Composite Controls
        1. Declarative Composites
        2. The GroupBox Control
        3. Programmatic Composites
        4. The LoginControl
      4. Server Controls and Client-Side Scripting
        1. Returning JavaScript to the Client
        2. The RegisterClientScriptBlock Method
        3. Keeping Your Code Off the Client
        4. The RolloverImageLink Control
        5. The NumTextBox Control
      5. Graphical Controls
        1. HTTP Handlers
        2. The Odometer Control
        3. How the Odometer Control Works
      6. Summary
    5. 9. Web Applications
      1. Structure of an ASP.NET Application
      2. The Web.config File
        1. <appSettings>
        2. <system.web>
        3. Configuration Inheritance
      3. The Global.asax File
        1. Global Directives
          1. The @ Application Directive
          2. The @ Import Directive
          3. The @ Assembly Directive
        2. Global Event Handlers
          1. Start and End Events
          2. Per-Request Events
          3. Error Events
        3. Global Object Tags
      4. Application State
        1. Using Application State
        2. Locking and Unlocking
        3. The AppCounter Application
      5. The Application Cache
        1. Adding and Removing Items
        2. Locking and Unlocking
        3. Expiration Policies
        4. Cache Removal Callbacks
        5. The Cache.Add Method
        6. The SmartQuotes Application
      6. Session State
        1. Using Session State
        2. The SessionSpy Page
        3. Cookieless Session State
        4. Session State Process Models
          1. In-Proc Session State
          2. State Server Session State
          3. SQL Server Session State
          4. State Servers, SQL Servers, and Serializable Objects
          5. Session Lifetimes
        5. Disabling Session State
        6. A Word on Web Farms
      7. The Congo.com Application
        1. Inside Congo.com
        2. On Your Own
    6. 10. ASP.NET Security
      1. Understanding Web Security
        1. Authentication
        2. Authorization
        3. IIS Security
        4. ASP.NET Security
      2. Windows Authentication
        1. Basic Authentication
        2. Digest Authentication
        3. Integrated Windows Authentication
        4. Getting Information About Authenticated Users
        5. Windows Authentication in Action
        6. Windows Authentication and URL Authorizations
        7. Windows Authentication and Role-Based Security
      3. Forms Authentication
        1. A First Look at Forms Authentication
        2. Real-World Forms Authentication
        3. Authentication Cookie Lifetime
        4. Forms Authentication and Role-Based Security
          1. Multiple Roles
        5. Signing Out
        6. Authentication Cookie Security
        7. Caveat Emptor
    7. 11. Web Services
      1. Web Services
        1. Your First Web Service
        2. Testing a Web Service
        3. Web Services and Code-Behind
        4. The WebService Base Class
        5. The WebMethod Attribute
        6. The Web Services Description Language
        7. Web Services and Complex Data Types
        8. Web Service Discovery—DISCO
        9. Web Service Discovery—UDDI
      2. Web Service Clients
        1. Web Service Proxies
        2. A Simple Web Service Client
        3. Avoiding Hard-Coded Service URLs
        4. Asynchronous Method Calls
        5. Web Service Clients and Proxy Servers
      3. The CityView Application
        1. How CityView Works
      4. For-Fee Web Services
      5. Dawn of a New Era
  6. III. The Cutting Edge
    1. 12. ADO.NET
      1. A Tale of Two Providers
        1. The System.Data.SqlClient and System.Data.OleDb Namespaces
      2. Connections, Commands, and DataReaders
        1. The SqlConnection Class
        2. The OleDbConnection Class
        3. Opening and Closing Connections
        4. Command Classes
        5. The ExecuteNonQuery Method
        6. The ExecuteScalar Method
        7. The ExecuteReader Method
          1. Closing a DataReader
        8. Transacted Commands
        9. Parameterized Commands
        10. Stored Procedures
      3. DataSets and DataAdapters
        1. The DataSet Class
          1. DataSets vs. DataReaders
        2. DataAdapter Classes
        3. Initializing a DataSet from a Database: DataAdapter.Fill
        4. DataTable and Friends
          1. Inserting Records into a DataTable
          2. Selecting Records in a DataTable
          3. Updating Records in a DataTable
          4. Deleting Records from a DataTable
        5. Propagating Changes Back to a Database: DataAdapter.Update
        6. CommandBuilder Classes
        7. The DataView Class
      4. A Word About XML
    2. 13. XML
      1. XML Primer
        1. Elements
        2. Attributes
        3. CDATA, PCDATA, and Entity References
        4. Namespaces
        5. Document Validity and Schemas
        6. XML Parsers
      2. Reading and Writing XML
        1. The XmlDocument Class
        2. The XmlTextReader Class
        3. The XmlValidatingReader Class
        4. The XmlTextWriter Class
      3. XPath
        1. XPath Basics
        2. XPathNavigator and Friends
        3. A Do-It-Yourself XPath Expression Evaluator
      4. XSL Transformations (XSLT)
        1. Converting XML to HTML on the Client
        2. Converting XML to HTML on the Server
        3. Converting XML Document Formats
      5. Summary
    3. 14. Multithreading
      1. Threads
        1. Starting Threads
        2. Foreground Threads vs. Background Threads
        3. Thread Priorities
        4. Suspending and Resuming Threads
        5. Terminating Threads
        6. If It Sounds Too Good to Be True…
        7. The Sieve and MultiSieve Applications
        8. Timer Threads
      2. Thread Synchronization
        1. The Interlocked Class
        2. Monitors
          1. The C# lock Keyword
          2. Conditionally Acquiring a Lock
          3. Waiting and Pulsing
        3. Monitor Internals
        4. Reader/Writer Locks
        5. Mutexes
        6. Events
        7. Waiting on Multiple Synchronization Objects
        8. Serializing Access to Collections
        9. Thread Synchronization via the MethodImpl Attribute
      3. Thread Pooling
    4. 15. Remoting
      1. Remoting Basics
        1. Your First Remoting Application
        2. Programmatic vs. Declarative Configuration
        3. Server Activation vs. Client Activation
        4. The Activator.GetObject and Activator.CreateInstance Methods
        5. Object Lifetimes and Lifetime Leases
      2. Advanced Remoting
        1. Using IIS as an Activation Agent
        2. HTTP Channels and Binary Formatters
        3. Delegates and Events
        4. Asynchronous Method Calls
          1. One-Way Methods
        5. Putting It All Together: The NetDraw Application
      3. Microsoft .NET: A Whole New Ball Game
  7. A. About the Author
    1. Jeff Prosise
  8. About the Author
  9. Copyright

Product information

  • Title: Programming Microsoft® .NET
  • Author(s): Jeff Prosise
  • Release date: June 2002
  • Publisher(s): Microsoft Press
  • ISBN: 9780735613768