Core C# and .NET

Book description

  • Written for C# 2.0 and .NET 2.0: contains coverage of generics, Master Pages, the DataGridView, and other new features

  • Covers Web development, Windows development, data management, security, threading, remoting, and much more

  • Presents hundreds of non-trivial code examples that help you solve real-world problems

  • The Complete and Comprehensive Developer's Guide to C# 2.0 and .NET 2.0

    Core C# and .NET is the no-nonsense, example-rich guide to achieving exceptional results with C# 2.0 and .NET 2.0. Writing for experienced programmers, Stephen Perry presents today's best practices for leveraging both C# 2.0 language features and Microsoft's .NET 2.0 infrastructure.

    Like all books in the Core Series, Core C# and .NET focuses on solving real-world problems with serious, non-trivial code. Perry's broad, deep coverage ranges from new C# generics to Web services, from reflection to security. He systematically introduces the development of Windows Forms applications and the effective use of GDI+ graphics classes. He offers detailed guidance on data management with XML and ADO.NET, plus advanced coverage of threading, remoting, and code security. Finally, Perry presents an extensive section on Web development, covering ASP.NET, state management, HTTP requests, and much more.

    With practical insights into everything from scalability to localization, this is the C# book you've been searching for: your definitive guide to building production-quality C# applications.

    Core C# and .NET delivers

  • Best practices for building C#/.NET Windows applications, Web applications, and Web services

  • Expert insight into security, scalability, and other crucial issues

  • Hundreds of professional-quality code examples

  • In-depth coverage of the latest C# 2.0 features, including generics

  • EVERY CORE SERIES BOOK:

    DEMONSTRATES practical techniques used by professional developers

    FEATURES robust, thoroughly tested sample code and realistic examples

    FOCUSES on the cutting-edge technologies you need to master today

    PROVIDES expert advice that will help you build superior software

    © Copyright Pearson Education. All rights reserved.

    Table of contents

    1. Copyright
    2. PRENTICE HALL CORE SERIES
    3. About the Author
    4. Foreword
    5. Preface
    6. Acknowledgments
    7. I. Fundamentals of C# Programming and Introduction to .NET
      1. 1. Introduction to .NET and C#
        1. 1.1. Overview of the .NET Framework
          1. Microsoft .NET and the CLI Standards
        2. 1.2. Common Language Runtime
          1. Compiling .NET Code
          2. Common Type System
          3. Assemblies
            1. Private and Shared Assemblies
            2. Precompiling an Assembly
            3. Code Verification
        3. 1.3. Framework Class Library
        4. 1.4. Working with the .NET Framework and SDK
          1. Updating the .NET Framework
          2. .NET Framework Tools
          3. Ildasm.exe
            1. Ildasm and Obfuscation
          4. wincv.exe
          5. Framework Configuration Tool
        5. 1.5. Understanding the C# Compiler
          1. Locating the Compiler
          2. Compiling from the Command Line
            1. Example 1: Compiling Multiple Files
            2. Example 2: Creating and Using a Code Library
            3. Example 3: Creating an Assembly with Multiple Files
        6. 1.6. Summary
        7. 1.7. Test Your Understanding
      2. 2. C# Language Fundamentals
        1. 2.1. The Layout of a C# Program
          1. General C# Programming Notes
            1. Case Sensitivity
            2. Naming Conventions
            3. Commenting a C# Program
        2. 2.2. Primitives
          1. decimal
          2. bool
          3. char
          4. byte, sbyte
          5. short, int, long
          6. single, double
          7. Using Parse and TryParse to Convert a Numeric String
        3. 2.3. Operators: Arithmetic, Logical, and Conditional
          1. Arithmetic Operators
          2. Conditional and Relational Operators
          3. Control Flow Statements
          4. if-else
          5. switch
        4. 2.4. Loops
          1. while loop
          2. do loop
          3. for loop
          4. foreach loop
          5. Transferring Control Within a Loop
        5. 2.5. C# Preprocessing Directives
          1. Conditional Compilation
          2. Diagnostic Directives
          3. Code Regions
        6. 2.6. Strings
          1. String Literals
          2. String Manipulation
            1. Indexing Individual Characters in a String
            2. String Concatenation
            3. Extracting and Locating Substrings
            4. Comparing Strings
        7. 2.7. Enumerated Types
          1. Working with Enumerations
          2. System.Enum Methods
          3. Enums and Bit Flags
        8. 2.8. Arrays
          1. Declaring and Creating an Array
          2. Using System.Array Methods and Properties
        9. 2.9. Reference and Value Types
          1. System.Object and System.ValueType
          2. Memory Allocation for Reference and Value Types
          3. Boxing
          4. Summary of Value and Reference Type Differences
            1. Memory Allocation
            2. Releasing Memory
            3. Variable Assignments
        10. 2.10. Summary
        11. 2.11. Test Your Understanding
      3. 3. Class Design in C#
        1. 3.1. Introduction to a C# Class
        2. 3.2. Defining a Class
          1. Attributes
            1. Examples
            2. Description
            3. Conditional Attribute
          2. Access Modifiers
          3. Abstract, Sealed, and Static Modifiers
          4. Class Identifier
          5. Base Classes, Interfaces, and Inheritance
            1. Example
        3. 3.3. Overview of Class Members
          1. Member Access Modifiers
        4. 3.4. Constants, Fields, and Properties
          1. Constants
          2. Fields
            1. Field Modifiers
            2. Using Static Read-Only Fields to Reference Class Instances
          3. Properties
          4. Indexers
        5. 3.5. Methods
          1. Method Modifiers
            1. Static Modifier
            2. Method Inheritance with Virtual and Override Modifiers
            3. New Modifier and Versioning
            4. Sealed and Abstract Modifiers
          2. Passing Parameters
        6. 3.6. Constructors
          1. Instance Constructor
            1. Inheritance and Constructors
            2. Using Initializers
          2. Private Constructor
          3. Static Constructor
        7. 3.7. Delegates and Events
          1. Delegates
          2. Delegate-Based Event Handling
            1. Working with Built-In Events
            2. Using Anonymous Methods with Delegates
            3. Defining Custom Events
            4. Defining a Delegate to Work with Events
            5. An Event Handling Example
        8. 3.8. Operator Overloading
        9. 3.9. Interfaces
          1. Creating and Using a Custom Interface
          2. Working with Interfaces
            1. Determining Which Interface Members Are Available
            2. Accessing Interface Methods
            3. Interfaces Versus Abstract Classes
        10. 3.10. Generics
        11. 3.11. Structures
          1. Defining Structures
          2. Using Methods and Properties with a Structure
        12. 3.12. Structure Versus Class
          1. Structures Are Value Types and Classes Are Reference Types
          2. Unlike a Class, a Structure Cannot Be Inherited
          3. General Rules for Choosing Between a Structure and a Class
        13. 3.13. Summary
        14. 3.14. Test Your Understanding
      4. 4. Working with Objects in C#
        1. 4.1. Object Creation
          1. Example: Creating Objects with Multiple Factories
        2. 4.2. Exception Handling
          1. System.Exception Class
          2. Writing Code to Handle Exceptions
            1. The try Block
            2. The catch Block
            3. The finally Block
          3. Example: Handling Common SystemException Exceptions
          4. How to Create a Custom Exception Class
          5. Unhandled Exceptions
            1. Unhandled Exceptions in a Windows Forms Application
          6. Exception Handling Guidelines
        3. 4.3. Implementing System.Object Methods in a Custom Class
          1. ToString() to Describe an Object
          2. Equals() to Compare Objects
            1. Overriding GetHashCode
            2. Determining If References Point to the Same Object
          3. Cloning to Create a Copy of an Object
            1. How to Create a Shallow Copy
        4. 4.4. Working with .NET Collection Classes and Interfaces
          1. Collection Interfaces
            1. ICollection Interface
            2. IHashCodeProvider Interface
            3. Using the IEnumerable and IEnumerator Interfaces to List the Contents of a Collection
            4. Iterators
            5. Using the IComparable and IComparer Interfaces to Perform Sorting
            6. IComparable
            7. IComparer
          2. System.Collections Namespace
          3. Stack and Queue
          4. ArrayList
            1. IList Interface
          5. Hashtable
            1. IDictionary Interface
            2. IDictionaryEnumerator Interface
            3. Create a Hashtable
            4. List Keys in a Hashtable
            5. List Values in a Hashtable
            6. List Keys and Values in a Hashtable
          6. System.Collections.Generic Namespace
            1. Comparison of System.Collections and System.Collections.Generic Namespaces
            2. An Example Using a Generics Collections Class
        5. 4.5. Object Serialization
          1. Binary Serialization
            1. Excluding Class Members from Serialization
            2. Binary Serialization Events
            3. Handling Version Changes to a Serialized Object
        6. 4.6. Object Life Cycle Management
          1. .NET Garbage Collection
            1. Object Finalization
            2. IDisposable.Dispose()
            3. Using Dispose and Finalize
        7. 4.7. Summary
        8. 4.8. Test Your Understanding
    8. II. Creating Applications Using the .NET Framework Class Library
      1. 5. C# Text Manipulation and File I/O
        1. 5.1. Characters and Unicode
          1. Unicode
          2. Working with Characters
            1. Assigning a Value to a Char Type
            2. Converting a Char Value to a Numeric Value
            3. Characters and Localization
            4. Characters and Their Unicode Categories
        2. 5.2. The String Class
          1. Creating Strings
            1. String Interning
          2. Overview of String Operations
        3. 5.3. Comparing Strings
          1. Using String.Compare
          2. Using String.CompareOrdinal
        4. 5.4. Searching, Modifying, and Encoding a String's Content
          1. Searching the Contents of a String
          2. Searching a String That Contains Surrogates
          3. String Transformations
          4. String Encoding
        5. 5.5. StringBuilder
          1. StringBuilder Class Overview
          2. StringBuilder Versus String Concatenation
        6. 5.6. Formatting Numeric and DateTime Values
          1. Constructing a Format Item
          2. Formatting Numeric Values
          3. Formatting Dates and Time
            1. Dates and Culture
            2. NumberFormatInfo and DateTimeFormatInfo Classes
        7. 5.7. Regular Expressions
          1. The Regex Class
            1. Regex Methods
              1. IsMatch()
              2. Replace()
              3. Split()
              4. Match() and Matches()
          2. Creating Regular Expressions
          3. A Pattern Matching Example
          4. Working with Groups
            1. Backreferencing a Group
          5. Examples of Using Regular Expressions
            1. Using Replace to Reverse Words
            2. Parsing Numbers
        8. 5.8. System.IO: Classes to Read and Write Streams of Data
          1. The Stream Class
          2. FileStreams
            1. Creating a FileStream
          3. MemoryStreams
          4. BufferedStreams
          5. Using StreamReader and StreamWriter to Read and Write Lines of Text
            1. Writing to a Text File
            2. Reading from a Text File
          6. StringWriter and StringReader
          7. Encryption with the CryptoStream Class
        9. 5.9. System.IO: Directories and Files
          1. FileSystemInfo
          2. Working with Directories Using the DirectoryInfo, Directory, and Path Classes
            1. Create a Subdirectory
            2. Delete a Subdirectory
            3. List Directories and Files
            4. Using the Path Class to Operate on Path Names
          3. Working with Files Using the FileInfo and File Classes
            1. Using FileInfo and File to Open Files
        10. 5.10. Summary
        11. 5.11. Test Your Understanding
      2. 6. Building Windows Forms Applications
        1. 6.1. Programming a Windows Form
          1. Building a Windows Forms Application by Hand
        2. 6.2. Windows.Forms Control Classes
          1. The Control Class
            1. Control Properties
          2. Working with Controls
            1. Size and Position
            2. How to Anchor and Dock a Control
            3. Tab Order and Focus
            4. Iterating Through Controls on a Form
          3. Control Events
            1. Handling Mouse Events
            2. Handling Keyboard Events
        3. 6.3. The Form Class
          1. Setting a Form's Appearance
            1. Form Opacity
            2. Form Transparency
          2. Setting Form Location and Size
          3. Displaying Forms
          4. The Life Cycle of a Modeless Form
            1. Creating and Displaying a Form
            2. Form Activation and Deactivation
            3. Closing a Form
          5. Forms Interaction—A Sample Application
            1. Code for the Main Form
            2. Code for the Search Form
          6. Owner and Owned Forms
          7. Message and Dialog Boxes
            1. MessageBox
            2. ShowDialog
          8. Multiple Document Interface Forms
            1. Creating a Menu and MDI Form
            2. Creating an MDI Menu Using VisualStudio.NET
        4. 6.4. Working with Menus
          1. MenuItem Properties
          2. Context Menus
            1. Constructing a Context Menu
        5. 6.5. Adding Help to a Form
          1. ToolTips
          2. Responding to F1 and the Help Button
          3. The HelpProvider Component
        6. 6.6. Forms Inheritance
          1. Building and Using a Forms Library
          2. Using the Inherited Form
            1. Overriding Events
            2. Creating Inherited Forms with Visual Studio.NET
        7. 6.7. Summary
        8. 6.8. Test Your Understanding
      3. 7. Windows Forms Controls
        1. 7.1. A Survey of .NET Windows Forms Controls
        2. 7.2. Button Classes, Group Box, Panel, and Label
          1. The Button Class
            1. Setting a Button's Appearance
            2. Handling Button Events
          2. The CheckBox Class
            1. Setting a CheckBox's Appearance
          3. The RadioButton Class
            1. Placing Radio Buttons in a Group
          4. The GroupBox Class
          5. The Panel Class
            1. The FlowLayoutPanel Control
            2. TableLayoutPanel Control
          6. The Label Class
        3. 7.3. PictureBox and TextBox Controls
          1. The PictureBox Class
          2. The TextBox Class
            1. TextBoxes and Carriage Returns
        4. 7.4. ListBox, CheckedListBox, and ComboBox Classes
          1. The ListBox Class
            1. Adding Items to a ListBox
            2. Selecting and Searching for Items in a ListBox
            3. Customizing the Appearance of a ListBox
          2. Other List Controls: the ComboBox and the CheckedListBox
        5. 7.5. The ListView and TreeView Classes
          1. The ListView Class
            1. Creating a ListView Object
            2. Define Appearance of ListView Object
            3. Set Column Headers
            4. Create ListView Items
            5. Specifying Icons
            6. Working with the ListView Control
              1. Iterating over All Items or Selected Items
              2. Detecting the Currently Selected Item
              3. Sorting Items on a ListView Control
          2. The TreeView Class
            1. The TreeNode Class
              1. Adding and Removing Nodes
              2. Iterating Through the Nodes in a TreeView
              3. Detecting a Selected Node
            2. A TreeView Example That Uses Reflection
        6. 7.6. The ProgressBar, Timer, and StatusStrip Classes
          1. Building a StatusStrip
        7. 7.7. Building Custom Controls
          1. Extending a Control
          2. Building a Custom UserControl
          3. A UserControl Example
          4. Using the Custom User Control
          5. Working with the User Control at Design Time
        8. 7.8. Using Drag and Drop with Controls
          1. Overview of Drag and Drop
            1. Source Control Responsibilities
            2. Target Control Responsibilities
        9. 7.9. Using Resources
          1. Working with Resource Files
            1. Creating Resource Strings from a Text File
            2. Using the ResourceWriter Class to Create a .resources File
            3. Using the ResourceManager Class to Access Resources
            4. Using the ResXResourceWriter Class to Create a .resx File
            5. Using the ResXResourceReader Class to Read a .resx file
            6. Converting a .resx File to a .resources File
            7. VS.NET and Resources
          2. Using Resource Files to Create Localized Forms
            1. Resource Localization Using Visual Studio.NET
            2. Determining Localization Resources at Runtime
            3. Creating a Satellite Assembly Without VS.NET
        10. 7.10. Summary
        11. 7.11. Test Your Understanding
      4. 8. .NET Graphics Using GDI+
        1. 8.1. GDI+ Overview
          1. The Graphics Class
            1. How to Obtain a Graphics Object from a Control Using CreateGraphics
            2. How to Obtain a Graphics Object Using Graphics Methods
          2. The Paint Event
            1. Using Invalidate() to Request a Paint Event
            2. Implementing a Paint Event Handler
        2. 8.2. Using the Graphics Object
          1. Basic 2-D Graphics
            1. Creating Shapes with the GraphicsPath Class
            2. Hit Testing with Shapes
          2. Pens
            1. DashStyle
            2. StartCap and EndCap
          3. Brushes
            1. The HatchBrush Class
            2. The LinearGradientBrush Class
              1. Creating a Multi-Color Gradient
          4. Colors
            1. How to Create a Color Object
            2. Examining the Characteristics of a Color Object
          5. A Sample Project: Building a Color Viewer
        3. 8.3. Images
          1. Loading and Storing Images
            1. A Note on Displaying Icons
          2. Manipulating Images
            1. Rotating and Mirroring
            2. Working with a Buffered Image
          3. Sample Project: Working with Images
            1. Implementing Menu Operations
            2. Drawing a Selection Rectangle on the Image
            3. Copying and Manipulating the Image on the Small Panel
          4. A Note on GDI and BitBlt for the Microsoft Windows Platform
        4. 8.4. Summary
        5. 8.4. Test Your Understanding
      5. 9. Fonts, Text, and Printing
        1. 9.1. Fonts
          1. Font Families
            1. Creating a FontFamily Object
            2. Listing Font Families
          2. The Font Class
            1. Creating a Font
            2. Using Font Metrics to Determine Font Height
        2. 9.2. Drawing Text Strings
          1. Drawing Multi-Line Text
          2. Formatting Strings with the StringFormat Class
          3. Using Tab Stops
          4. String Trimming, Alignment, and Wrapping
            1. Example 1: Printing Without a StringFormat Object
            2. Example 2: Printing with NoWrap Option
            3. Example 3: Printing with NoWrap and Clipping on a Word
            4. Example 4: Printing with NoWrap, Clipping on Word, and Right Justification
        3. 9.3. Printing
          1. Overview
          2. PrintDocument Class
          3. Printer Settings
            1. Selecting a Printer
            2. Selecting Pages to Print
            3. Setting Printer Resolution
          4. Page Settings
          5. PrintDocument Events
            1. BeginPrint Event
            2. EndPrint Event
            3. QueryPageSettingsEvent Event
          6. PrintPage Event
            1. Defining the PrintPage Event Handler
          7. Previewing a Printed Report
          8. A Report Example
            1. Data Source for the Report
            2. Code for the Application
          9. Creating a Custom PrintDocument Class
        4. 9.4. Summary
        5. 9.5. Test Your Understanding
      6. 10. Working with XML in .NET
        1. 10.1. Working with XML
          1. Using XML Serialization to Create XML Data
            1. An Example Using the XmlSerializer Class
            2. Serialization Attributes
          2. XML Schema Definition (XSD)
            1. XML Schema Validation
          3. Using an XML Style Sheet
            1. The XslTransform Class
        2. 10.2. Techniques for Reading XML Data
          1. XmlReader Class
          2. XmlNodeReader Class
          3. The XmlReaderSettings Class
          4. Using an XML Schema to Validate XML Data
          5. Options for Reading XML Data
        3. 10.3. Techniques for Writing XML Data
          1. Writing XML with the XmlWriter Class
        4. 10.4. Using XPath to Search XML
          1. Constructing XPath Queries
          2. XmlDocument and XPath
          3. XPathDocument and XPath
          4. XmlDataDocument and XPath
            1. Adding and Removing Nodes on a Tree
        5. 10.5. Summary
        6. 10.6. Test Your Understanding
      7. 11. ADO.NET
        1. 11.1. Overview of the ADO.NET Architecture
          1. OLE DB Data Provider in .NET
          2. .NET Data Provider
            1. Data Provider Objects for Accessing Data
            2. Provider Factories
        2. 11.2. Data Access Models: Connected and Disconnected
          1. Connected Model
          2. Disconnected Model
        3. 11.3. ADO.NET Connected Model
          1. Connection Classes
            1. Connection String
            2. Connection Pooling
          2. The Command Object
            1. Creating a Command Object
            2. Executing a Command
            3. Executing Stored Procedures with the Command Object
            4. Using Parameterized Commands Without Stored Procedures
          3. DataReader Object
            1. Accessing Rows with DataReader
            2. Accessing Column Values with DataReader
        4. 11.4. DataSets, DataTables, and the Disconnected Model
          1. The DataSet Class
          2. DataTables
            1. DataColumns
            2. DataRows
          3. Loading Data into a DataSet
            1. Using the DataReader to Load Data into a DataSet
            2. Using the DataAdapter to Load Data into a DataSet
          4. Using the DataAdapter to Update a Database
            1. The CommandBuilder Object
            2. Synchronizing the DataSet and the DataBase
              1. Using Transactions to Roll Back Multiple Updates
              2. Identifying Rows That Cause Update Errors
          5. Defining Relationships Between Tables in a DataSet
            1. Relations and Constraints
          6. Choosing Between the Connected and Disconnected Model
        5. 11.5. XML and ADO.NET
          1. Using a DataSet to Create XML Data and Schema Files
          2. Creating a DataSet Schema from XML
          3. Reading XML Data into a DataSet
            1. Using ReadXml with Nested XML Data
        6. 11.6. Summary
        7. 11.7. Test Your Understanding
      8. 12. Data Binding with Windows Forms Controls
        1. 12.1. Overview of Data Binding
          1. Simple Data Binding
            1. Binding to a List
            2. Simple Binding with ADO.NET
          2. Complex Data Binding with List Controls
          3. One-Way and Two-Way Data Binding
            1. Effects on the Data Source of Updating a Control Value
            2. Effects on a Control of Updating the Data Source
          4. Using Binding Managers
            1. Using the BindingManagerBase to Navigate a List
        2. 12.2. Using Simple and Complex Data Binding in an Application
          1. Binding to a DataTable
          2. Binding Controls to an ArrayList
          3. Adding an Item to the Data Source
          4. Identifying Updates
          5. Update Original Database with Changes
        3. 12.3. The DataGridView Class
          1. Properties
            1. Constructing a DataGridView
            2. DataBinding with a DataGridView
            3. Setting the Row Height
            4. Working with Columns and Column Types
          2. Events
            1. Cell Formatting
            2. Recognizing Selected Rows, Columns, and Cells
            3. Data Error Handling
          3. Setting Up Master-Detail DataGridViews
          4. Virtual Mode
        4. 12.4. Summary
        5. 12.4. Test Your Understanding
    9. III. Advanced Use of C# and the .NET Framework
      1. 13. Asynchronous Programming and Multithreading
        1. 13.1. What Is a Thread?
          1. Multithreading
            1. Thread Priority
            2. Foreground and Background Threads
            3. Thread State
        2. 13.2. Asynchronous Programming
          1. Asynchronous Delegates
            1. Understanding the Delegate Class
              1. Constructor
              2. Invoke
              3. BeginInvoke
              4. EndInvoke
          2. Examples of Implementing Asynchronous Calls
            1. Using Polling and Synchronization Objects
            2. Using Callbacks
            3. Multiple Threads and User Interface Controls
            4. Using MethodInvoker to Create a Thread
            5. Using Asynchronous Calls to Perform I/O
        3. 13.3. Working Directly with Threads
          1. Creating and Working with Threads
            1. The Current Thread
            2. Creating Threads
            3. Aborting a Thread
          2. Multithreading in Action
          3. Using the Thread Pool
          4. Timers
            1. System.Timers.Timer Class
            2. System.Windows.Forms.Timer Class
        4. 13.4. Thread Synchronization
          1. The Synchronization Attribute
          2. The Monitor Class
            1. Using Monitor to Lock an Object
            2. Encapsulating a Monitor
          3. The Mutex
          4. The Semaphore
          5. Avoiding Deadlock
          6. Summary of Synchronization Techniques
        5. 13.5. Summary
        6. 13.5. Test Your Understanding
      2. 14. Creating Distributed Applications with Remoting
        1. 14.1. Application Domains
          1. Advantages of AppDomains
          2. Application Domains and Assemblies
          3. Working with the AppDomain Class
        2. 14.2. Remoting
          1. Remoting Architecture
            1. Proxies
            2. Formatters
            3. Channels
            4. Assigning a Name to a Channel
          2. Types of Remoting
            1. Marshaling by Value
            2. Marshaling by Reference
          3. Client-Activated Objects
          4. Server-Activated Objects
            1. Server-Activated Singleton
            2. Server-Activated Single Call
          5. Type Registration
            1. Registering Server-Activated Objects
            2. Registering Client-Activated Objects
            3. Type Registration Using a Configuration File
          6. Remoting with a Server-Activated Object
            1. A Message Server Example
              1. Server Assembly
              2. Host Assembly
              3. Client Assembly
            2. MessageServer Configuration Files
            3. Using an Interface Assembly with Server-Activated Objects
          7. Remoting with a Client-Activated Object (CAO)
            1. An Image Server Example
              1. Host Assembly
              2. Server Assembly
              3. Client Assembly
            2. Deploying the CAO Application
          8. Design Considerations in Creating a Distributed Application
            1. Configuring Assemblies
        3. 14.3. Leasing and Sponsorship
          1. Leasing
            1. Setting Initial Lease Values for Objects in an Application
            2. Setting the Lease Values for an Individual Object
            3. The Lease Manager
            4. The Lifetime of a Lease
          2. Sponsorship
        4. 14.4. Summary
        5. 14.5. Test Your Understanding
      3. 15. Code Refinement, Security, and Deployment
        1. 15.1. Following .NET Code Design Guidelines
          1. Using FxCop
        2. 15.2. Strongly Named Assemblies
          1. Creating a Strongly Named Assembly
          2. Delayed Signing
          3. Global Assembly Cache (GAC)
          4. Versioning
            1. Assigning a Version Number to an Assembly
        3. 15.3. Security
          1. Permissions and Permission Sets
            1. Named Permission Sets
            2. Permission Set Attributes
            3. .NET Built-in Security Permissions
            4. Identity Permissions
            5. Permission Attributes
          2. Evidence
          3. Security Policies
            1. How .NET Applies Security Policies
          4. Configuring Security Policy
          5. The .NET Framework Configuration Tool
            1. The Default Configuration Policies
              1. My_Computer_Zone Code Group
              2. LocalIntranet_Zone Code Group
          6. Configuring Code Access Security with the Configuration Tool—An Example
            1. Creating a Permission Set
            2. Creating a Code Group
            3. Testing the New Code Group
            4. Determining the Permissions Granted to an Assembly
            5. Determining the Permissions Required by an Assembly
          7. Requesting Permissions for an Assembly
            1. How to Apply a Permission Attribute
            2. Testing a Permission Attribute
          8. Programmatic Security
            1. Stack Walk
            2. Stack Walk Modifiers
            3. Declarative Security Using Permission Attributes
        4. 15.4. Application Deployment Considerations
          1. Microsoft Windows Deployment: XCOPY Deployment Versus the Windows Installer
          2. Deploying Assemblies in the Global Assembly Cache
          3. Deploying Private Assemblies
          4. Using CodeBase Configuration
          5. Using a Configuration File to Manage Multiple Versions of an Assembly
          6. Assembly Version and Product Information
        5. 15.5. Summary
        6. 15.6. Test Your Understanding
    10. Programming for the Internet
      1. 16. ASP.NET Web Forms and Controls
        1. 16.1. Client-Server Interaction over the Internet
          1. Web Application Example: Implementing a BMI Calculator
            1. A JavaScript BMI Calculator
            2. An ASP (Active Server Pages) BMI Calculator
          2. Using ASP.NET to Implement a BMI Calculator
          3. Inline Code Model
            1. View State
            2. The @Page Directive
            3. Other Directives
              1. @Import Directive
              2. @Assembly Directive
              3. @Register Directive
          4. The Code-Behind Model
            1. Handling Events on the Server
          5. Code-Behind with Partial Classes
          6. Page Class
            1. HttpRequest and HttpResponse Objects
            2. Using IsPostBack
            3. Page Events
            4. Cross-Page Posting
        2. 16.2. Web Forms Controls
          1. Web Controls Overview
          2. Specifying the Appearance of a Web Control
          3. Simple Controls
            1. Using the Page_Load Event to Initialize the Screen
            2. Buttons
            3. Using Panels
            4. Text Box
          4. List Controls
            1. Filling the Control with Data
            2. Selecting an Item
          5. The DataList Control
        3. 16.3. Data Binding and Data Source Controls
          1. Binding to a DataReader
          2. Binding to a DataSet
          3. DataSource Controls
            1. SqlDataSource Control
            2. ObjectDataSource Control
            3. XmlDataSource Control
        4. 16.4. Validation Controls
          1. Using Validation Controls
            1. CustomValidator Control
            2. ValidationSummary Control
        5. 16.5. Master and Content Pages
          1. Creating a Master Page
          2. Creating a Content Page
          3. Accessing the Master Page from a Content Page
        6. 16.6. Building and Using Custom Web Controls
          1. A Custom Control Example
          2. Using a Custom Control
          3. Control State Management
          4. Composite Controls
        7. 16.7. Selecting a Web Control to Display Data
        8. 16.8. Summary
        9. 16.9. Test Your Understanding
      2. 17. The Asp.Net Application Environment
        1. 17.1. HTTP Request and Response Classes
          1. HttpRequest Object
            1. HTTP Request Message Structure
            2. Viewing the Request Message
            3. HttpRequest Class Structure
          2. HttpResponse Object
            1. HTTP Response Message Structure
            2. Viewing an HTTP Response Message
            3. HttpResponse Class Properties
            4. Using HttpResponse Methods
        2. 17.2. ASP.NET and Configuration Files
          1. A Look Inside web.config
            1. <appSettings> Configuration Section
            2. <location> Configuration Section
            3. <system.web> Configuration Section
              1. The <compilation> Section
              2. The <customErrors> Section
              3. The <trace> Section
              4. The <sessionState> Section
              5. The <connectionStrings> Section
          2. Adding a Custom Configuration Section
        3. 17.3. ASP.NET Application Security
          1. Forms Authentication
            1. Security Settings in web.config for Forms Authentication
          2. An Example of Forms Authentication
            1. Using web.config for Authentication and Authorization
            2. The Login Screen—Using the FormsAuthentication Class
            3. Adding Role-Based Authorization with global.asax
            4. Viewing Authentication Information
        4. 17.4. Maintaining State
          1. Application State
            1. Accessing and Updating Application State Data
            2. Considerations in Using Application State
          2. Session State
            1. In-Process Session State
            2. Out-of-Process Session Using a State Server Process
            3. Out-of-Process Session Using SQL Server
        5. 17.5. Caching
          1. Page Output Caching
            1. Specifying Cache Duration
            2. Specifying the Caching Location
            3. Conditional Caching with VaryByParam, VaryByHeader, and VaryByCustom
            4. Caching a Partial Page (Fragment Caching)
          2. Data Caching
            1. Adding Items to a Data Cache
            2. Retrieving Items from the Data Cache
            3. Data Caching as a Substitute for ViewState
        6. 17.6. Creating a Web Client with WebRequest and WebResponse
          1. WebRequest and WebResponse Classes
          2. Web Client Example
        7. 17.7. HTTP Pipeline
          1. Processing a Request in the Pipeline
          2. HttpApplication Class
            1. global.asax File
            2. Using a Code-Behind File with global.asax
          3. HTTP Modules
            1. Implementing a Custom HttpModule
            2. Deploying a Custom HttpModule
            3. URL Rewriting with a Custom Module
            4. Choosing Between an HTTP Module and global.asax
          4. HTTP Handlers
            1. Implementing a Custom HTTP Handler
            2. Deploying a Custom HTTP Handler
        8. 17.8. Summary
        9. 17.9. Test Your Understanding
      3. 18. XML Web Services
        1. 18.1. Introduction to Web Services
          1. Discovering and Using a Web Service
            1. Introduction to UDDI
            2. UDDI Discovery Example
              1. Step 1: Send Discovery Request
              2. Step 2: Registry Service Responds with List of Services Matching Request
              3. Step 3: Retrieve Overview Document Containing WSDL
            3. How to Communicate with a UDDI Service Registry
        2. 18.2. Building an XML Web Service
          1. Creating a Web Service by Hand
            1. WebService Directive
            2. WebMethod Attribute
            3. Testing the Web Service
          2. Creating a Web Service Using VS.NET
            1. System.Web.Services.WebService Class
          3. Extending the Web Service with the WebService and WebMethod Attributes
            1. The WebService Attribute
            2. The WebMethod Attribute
              1. EnableSession: Activate the Use of Session State Information
              2. MessageName: Create Overloaded Web Operations
              3. CacheDuration: Caching Output from a Web Operation
            3. Using web.config to Configure Web Service Options
        3. 18.3. Building an XML Web Service Client
          1. Creating a Simple Client to Access the Web Service Class
            1. Using wsdl.exe to Create a Proxy
            2. Synchronous Calls to a Web Service Method
            3. Asynchronous Calls to a Web Service Method
            4. Event-Based Asynchronous Calls
            5. Using the CookieContainer Property to Maintain Session State
          2. Creating a Proxy with Visual Studio.NET
        4. 18.4. Understanding WSDL and SOAP
          1. Web Services Description Language (WSDL)
            1. The WSDL Structure
              1. <Definitions>
              2. <Types>
              3. <Message>
              4. <PortType>
              5. <Binding>
              6. <Service>
          2. Simple Object Access Protocol (SOAP)
            1. A SOAP Request Message
            2. A SOAP Response Message
            3. Using the SOAP Header for User Authentication
            4. Handling SOAP Exceptions
            5. SOAP Security
        5. 18.5. Using Web Services with Complex Data Types
          1. A Web Service to Return Images
          2. Using Amazon Web Services
            1. Sending a Request with the AmazonSearchService Class
            2. Using the ProductInfo Class to Process the Web Service Response
          3. Creating a Proxy for the Amazon Web Services
          4. Building a WinForms Web Service Client
        6. 18.6. Web Services Performance
          1. Configuring the HTTP Connection
            1. Expect100Continue
            2. The Nagle Algorithm
          2. Working with Large Amounts of Data
        7. 18.7. Summary
        8. 18.8. Test Your Understanding
    11. A. Features Specific to .NET 2.0 and C# 2.0
    12. B. DataGridView Events and Delegates
    13. Answers to Chapter Exercises
      1. Chapter 1
      2. Chapter 2
      3. Chapter 3
      4. Chapter 4
      5. Chapter 5
      6. Chapter 6
      7. Chapter 7
      8. Chapter 8
      9. Chapter 9
      10. Chapter 10
      11. Chapter 11
      12. Chapter 12
      13. Chapter 13
      14. Chapter 14
      15. Chapter 15
      16. Chapter 16
      17. Chapter 17
      18. Chapter 18

    Product information

    • Title: Core C# and .NET
    • Author(s): Stephen C. Perry
    • Release date: September 2005
    • Publisher(s): Pearson
    • ISBN: 9780131472273