Beginning ASP.NET 4 in C# 2010

Book description

The most up-to-date and comprehensive introductory ASP.NET book you'll find on any shelf, Beginning ASP.NET 4 in C# 2010 guides you through Microsoft's latest technology for building dynamic web sites. This book will enable you to build dynamic web pages on the fly, and assumes only the most basic knowledge of C#.

The book provides exhaustive coverage of ASP.NET, guiding you from your first steps right up to the most advanced techniques, such as querying databases from within a web page and tuning your site for optimal performance. Within these pages, you'll find tips for "best practices" and comprehensive discussions of key database and XML principles you need to know in order to be effective with ASP.NET. The book also emphasizes the invaluable coding techniques of object orientation and code behind, which will start you off on the track to building real-world web sites right from the beginning—rather than just faking it with simplified coding practices.

By the time you've finished the book, you will have mastered the core techniques and have all the knowledge you need to begin work as a professional ASP.NET developer.

Table of contents

  1. Copyright
  2. About the Author
  3. About the Technical Reviewer
  4. Acknowledgments
  5. Introduction
    1. About This Book
      1. Who Should Read This Book
      2. What You Need to Use This Book
    2. Code Samples
    3. Chapter Overview
      1. Part 1: Introducing .NET
      2. Part 2: Developing ASP.NET Applications
      3. Part 3: Building Better Web Forms
      4. Part 4: Working with Data
      5. Part 5: Website Security
      6. Part 6: Advanced ASP.NET
    4. Feedback
  6. 1. Introducing .NET
    1. 1. The .NET Framework
      1. 1.1. The Evolution of Web Development
        1. 1.1.1. HTML and HTML Forms
        2. 1.1.2. Server-Side Programming
        3. 1.1.3. Client-Side Programming
      2. 1.2. The .NET Framework
        1. 1.2.1. C#, VB, and the .NET Languages
          1. 1.2.1.1. Intermediate Language
        2. 1.2.2. The Common Language Runtime
        3. 1.2.3. The .NET Class Library
        4. 1.2.4. Visual Studio
      3. 1.3. The Last Word
    2. 2. The C# Language
      1. 2.1. The .NET Languages
      2. 2.2. C# Language Basics
        1. 2.2.1. Case Sensitivity
        2. 2.2.2. Commenting
        3. 2.2.3. Statement Termination
        4. 2.2.4. Blocks
      3. 2.3. Variables and Data Types
        1. 2.3.1. Assignment and Initializers
        2. 2.3.2. Strings and Escaped Characters
        3. 2.3.3. Arrays
          1. 2.3.3.1. The ArrayList
        4. 2.3.4. Enumerations
      4. 2.4. Variable Operations
        1. 2.4.1. Advanced Math
        2. 2.4.2. Type Conversions
      5. 2.5. Object-Based Manipulation
        1. 2.5.1. The String Type
        2. 2.5.2. The DateTime and TimeSpan Types
        3. 2.5.3. The Array Type
      6. 2.6. Conditional Logic
        1. 2.6.1. The if Statement
        2. 2.6.2. The switch Statement
      7. 2.7. Loops
        1. 2.7.1. The for Loop
        2. 2.7.2. The foreach Loop
        3. 2.7.3. The while loop
      8. 2.8. Methods
        1. 2.8.1. Parameters
        2. 2.8.2. Method Overloading
        3. 2.8.3. Optional and Named Parameters
        4. 2.8.4. Delegates
      9. 2.9. The Last Word
    3. 3. Types, Objects, and Namespaces
      1. 3.1. The Basics About Classes
        1. 3.1.1. Static Members
        2. 3.1.2. A Simple Class
      2. 3.2. Building a Basic Class
        1. 3.2.1. Creating an Object
        2. 3.2.2. Adding Properties
        3. 3.2.3. Automatic Properties
        4. 3.2.4. Adding a Method
        5. 3.2.5. Adding a Constructor
        6. 3.2.6. Adding an Event
        7. 3.2.7. Testing the Product Class
      3. 3.3. Value Types and Reference Types
        1. 3.3.1. Assignment Operations
        2. 3.3.2. Equality Testing
        3. 3.3.3. Passing Parameters by Reference and by Value
        4. 3.3.4. Reviewing .NET Types
      4. 3.4. Understanding Namespaces and Assemblies
        1. 3.4.1. Using Namespaces
        2. 3.4.2. Importing Namespaces
        3. 3.4.3. Assemblies
      5. 3.5. Advanced Class Programming
        1. 3.5.1. Inheritance
        2. 3.5.2. Static Members
        3. 3.5.3. Casting Objects
        4. 3.5.4. Partial Classes
        5. 3.5.5. Generics
      6. 3.6. The Last Word
  7. 2. Developing ASP.NET Applications
    1. 4. Visual Studio
      1. 4.1. The Promise of Visual Studio
      2. 4.2. Creating Websites
        1. 4.2.1. Creating an Empty Web Application
        2. 4.2.2. Websites and Web Projects
        3. 4.2.3. The Hidden Solution Files
        4. 4.2.4. The Solution Explorer
        5. 4.2.5. Adding Web Forms
        6. 4.2.6. Migrating a Website from a Previous Version of Visual Studio
      3. 4.3. Designing a Web Page
        1. 4.3.1. Adding Web Controls
        2. 4.3.2. The Properties Window
      4. 4.4. The Anatomy of a Web Form
        1. 4.4.1. The Web Form Markup
        2. 4.4.2. The Page Directive
        3. 4.4.3. The Doctype
        4. 4.4.4. The Essentials of XHTML
          1. 4.4.4.1. Elements
          2. 4.4.4.2. Attributes
          3. 4.4.4.3. Formatting
          4. 4.4.4.4. A Complete Web Page
      5. 4.5. Writing Code
        1. 4.5.1. The Code-Behind Class
        2. 4.5.2. Adding Event Handlers
        3. 4.5.3. Outlining
        4. 4.5.4. IntelliSense
          1. 4.5.4.1. Member List
          2. 4.5.4.2. Error Underlining
          3. 4.5.4.3. Automatically Importing Namespaces
        5. 4.5.5. Code Formatting and Coloring
      6. 4.6. Visual Studio Debugging
        1. 4.6.1. The Visual Studio Web Server
        2. 4.6.2. Single-Step Debugging
        3. 4.6.3. Variable Watches
      7. 4.7. The Last Word
    2. 5. Web Form Fundamentals
      1. 5.1. The Anatomy of an ASP.NET Application
        1. 5.1.1. ASP.NET File Types
        2. 5.1.2. ASP.NET Application Directories
      2. 5.2. Introducing Server Controls
        1. 5.2.1. HTML Server Controls
        2. 5.2.2. Converting an HTML Page to an ASP.NET Page
        3. 5.2.3. View State
        4. 5.2.4. The HTML Control Classes
        5. 5.2.5. Adding the Currency Converter Code
        6. 5.2.6. Event Handling
        7. 5.2.7. Behind the Scenes with the Currency Converter
        8. 5.2.8. Error Handling
      3. 5.3. Improving the Currency Converter
        1. 5.3.1. Adding Multiple Currencies
          1. 5.3.1.1. Dissecting the Code . . .
        2. 5.3.2. Storing Information in the List
        3. 5.3.3. Adding Linked Images
        4. 5.3.4. Setting Styles
      4. 5.4. A Deeper Look at HTML Control Classes
        1. 5.4.1. HTML Control Events
        2. 5.4.2. Advanced Events with the HtmlInputImage Control
        3. 5.4.3. The HtmlControl Base Class
        4. 5.4.4. The HtmlContainerControl Class
        5. 5.4.5. The HtmlInputControl Class
      5. 5.5. The Page Class
        1. 5.5.1. Sending the User to a New Page
        2. 5.5.2. HTML Encoding
      6. 5.6. Application Events
        1. 5.6.1. The global.asax File
        2. 5.6.2. Additional Application Events
      7. 5.7. ASP.NET Configuration
        1. 5.7.1. The web.config File
        2. 5.7.2. Nested Configuration
        3. 5.7.3. Storing Custom Settings in the web.config File
        4. 5.7.4. The Website Administration Tool (WAT)
      8. 5.8. The Last Word
    3. 6. Web Controls
      1. 6.1. Stepping Up to Web Controls
        1. 6.1.1. Basic Web Control Classes
        2. 6.1.2. The Web Control Tags
      2. 6.2. Web Control Classes
        1. 6.2.1. The WebControl Base Class
        2. 6.2.2. Units
        3. 6.2.3. Enumerations
        4. 6.2.4. Colors
        5. 6.2.5. Fonts
        6. 6.2.6. Focus
        7. 6.2.7. The Default Button
      3. 6.3. List Controls
        1. 6.3.1. Multiple-Select List Controls
        2. 6.3.2. The BulletedList Control
      4. 6.4. Table Controls
      5. 6.5. Web Control Events and AutoPostBack
        1. 6.5.1. How Postback Events Work
        2. 6.5.2. The Page Life Cycle
          1. 6.5.2.1. Dissecting the Code . . .
      6. 6.6. A Simple Web Page
        1. 6.6.1. Improving the Greeting Card Generator
        2. 6.6.2. Generating the Cards Automatically
      7. 6.7. The Last Word
    4. 7. Error Handling, Logging, and Tracing
      1. 7.1. Common Errors
      2. 7.2. Exception Handling
        1. 7.2.1. The Exception Class
        2. 7.2.2. The Exception Chain
      3. 7.3. Handling Exceptions
        1. 7.3.1. Catching Specific Exceptions
        2. 7.3.2. Nested Exception Handlers
          1. 7.3.2.1. Dissecting the Code . . .
        3. 7.3.3. Exception Handling in Action
        4. 7.3.4. Mastering Exceptions
      4. 7.4. Throwing Your Own Exceptions
      5. 7.5. Logging Exceptions
        1. 7.5.1. Viewing the Windows Event Logs
        2. 7.5.2. Writing to the Event Log
        3. 7.5.3. Custom Logs
        4. 7.5.4. A Custom Logging Class
        5. 7.5.5. Retrieving Log Information
      6. 7.6. Page Tracing
        1. 7.6.1. Enabling Tracing
        2. 7.6.2. Tracing Information
          1. 7.6.2.1. Request Details
          2. 7.6.2.2. Trace Information
          3. 7.6.2.3. Control Tree
          4. 7.6.2.4. Session State and Application State
          5. 7.6.2.5. Request Cookies and Response Cookies
          6. 7.6.2.6. Headers Collection
          7. 7.6.2.7. Form Collection
          8. 7.6.2.8. Query String Collection
          9. 7.6.2.9. Server Variables
        3. 7.6.3. Writing Trace Information
        4. 7.6.4. Application-Level Tracing
      7. 7.7. The Last Word
    5. 8. State Management
      1. 8.1. The Problem of State
      2. 8.2. View State
        1. 8.2.1. The ViewState Collection
        2. 8.2.2. A View State Example
        3. 8.2.3. Making View State Secure
          1. 8.2.3.1. Tamper-Proof View State
          2. 8.2.3.2. Private View State
        4. 8.2.4. Retaining Member Variables
        5. 8.2.5. Storing Custom Objects
      3. 8.3. Transferring Information Between Pages
        1. 8.3.1. Cross-Page Posting
          1. 8.3.1.1. Getting More Information from the Source Page
        2. 8.3.2. The Query String
          1. 8.3.2.1. A Query String Example
          2. 8.3.2.2. URL Encoding
      4. 8.4. Cookies
        1. 8.4.1. A Cookie Example
      5. 8.5. Session State
        1. 8.5.1. Session Tracking
        2. 8.5.2. Using Session State
        3. 8.5.3. A Session State Example
      6. 8.6. Session State Configuration
        1. 8.6.1. Cookieless
        2. 8.6.2. Timeout
        3. 8.6.3. Mode
          1. 8.6.3.1. InProc
          2. 8.6.3.2. Off
          3. 8.6.3.3. StateServer
          4. 8.6.3.4. SQLServer
            1. 8.6.3.4.1. Custom
          5. 8.6.3.5. Compression
      7. 8.7. Application State
      8. 8.8. An Overview of State Management Choices
      9. 8.9. The Last Word
  8. 3. Building Better Web Forms
    1. 9. Validation
      1. 9.1. Understanding Validation
        1. 9.1.1. The Validation Controls
        2. 9.1.2. Server-Side Validation
        3. 9.1.3. Client-Side Validation
      2. 9.2. The Validation Controls
        1. 9.2.1. A Simple Validation Example
        2. 9.2.2. Other Display Options
        3. 9.2.3. Manual Validation
        4. 9.2.4. Validating with Regular Expressions
          1. 9.2.4.1. Literals and Metacharacters
          2. 9.2.4.2. Finding a Regular Expression
        5. 9.2.5. A Validated Customer Form
        6. 9.2.6. Validation Groups
      3. 9.3. The Last Word
    2. 10. Rich Controls
      1. 10.1. The Calendar
        1. 10.1.1. Formatting the Calendar
        2. 10.1.2. Restricting Dates
      2. 10.2. The AdRotator
        1. 10.2.1. The Advertisement File
        2. 10.2.2. The AdRotator Class
      3. 10.3. Pages with Multiple Views
        1. 10.3.1. The MultiView Control
          1. 10.3.1.1. Creating Views
          2. 10.3.1.2. Showing a View
        2. 10.3.2. The Wizard Control
          1. 10.3.2.1. Wizard Steps
          2. 10.3.2.2. Wizard Events
          3. 10.3.2.3. Formatting the Wizard
          4. 10.3.2.4. Validation with the Wizard
      4. 10.4. The Last Word
    3. 11. User Controls and Graphics
      1. 11.1. User Controls
        1. 11.1.1. Creating a Simple User Control
        2. 11.1.2. Independent User Controls
        3. 11.1.3. Integrated User Controls
        4. 11.1.4. User Control Events
        5. 11.1.5. Passing Information with Events
      2. 11.2. Dynamic Graphics
        1. 11.2.1. Basic Drawing
        2. 11.2.2. Drawing a Custom Image
        3. 11.2.3. Placing Custom Images Inside Web Pages
        4. 11.2.4. Image Format and Quality
      3. 11.3. The Last Word
    4. 12. Styles, Themes, and Master Pages
      1. 12.1. Styles
        1. 12.1.1. Style Types
        2. 12.1.2. Creating a Basic Inline Style
          1. 12.1.2.1. The Style Builder
          2. 12.1.2.2. The CSS Properties Window
          3. 12.1.2.3. Style Inheritance
        3. 12.1.3. Creating a Style Sheet
          1. 12.1.3.1. The CSS Outline Window
        4. 12.1.4. Applying Style Sheet Rules
          1. 12.1.4.1. The Apply Styles Window
          2. 12.1.4.2. Creating More Styles
      2. 12.2. Themes
        1. 12.2.1. How Themes Work
        2. 12.2.2. Applying a Simple Theme
        3. 12.2.3. Handling Theme Conflicts
        4. 12.2.4. Creating Multiple Skins for the Same Control
        5. 12.2.5. More Advanced Skins
      3. 12.3. Master Page Basics
        1. 12.3.1. A Simple Master Page and Content Page
        2. 12.3.2. How Master Pages and Content Pages Are Connected
        3. 12.3.3. A Master Page with Multiple Content Regions
        4. 12.3.4. Default Content
        5. 12.3.5. Master Pages and Relative Paths
      4. 12.4. Advanced Master Pages
        1. 12.4.1. Style-Based Layouts
        2. 12.4.2. Code in a Master Page
        3. 12.4.3. Interacting with a Master Page Programmatically
      5. 12.5. The Last Word
    5. 13. Website Navigation
      1. 13.1. Site Maps
        1. 13.1.1. Defining a Site Map
          1. 13.1.1.1. Rule 1: Site Maps Begin with the <siteMap> Element
          2. 13.1.1.2. Rule 2: Each Page Is Represented by a <siteMapNode> Element
          3. 13.1.1.3. Rule 3: A <siteMapNode> Element Can Contain Other <siteMapNode> Elements
          4. 13.1.1.4. Rule 4: Every Site Map Begins with a Single <siteMapNode>
          5. 13.1.1.5. Rule 5: Duplicate URLs Are Not Allowed
        2. 13.1.2. Seeing a Simple Site Map in Action
        3. 13.1.3. Binding an Ordinary Page to a Site Map
        4. 13.1.4. Binding a Master Page to a Site Map
        5. 13.1.5. Binding Portions of a Site Map
          1. 13.1.5.1. Showing Subtrees
          2. 13.1.5.2. Using Different Site Maps in the Same File
        6. 13.1.6. The SiteMap Class
      2. 13.2. URL Mapping and Routing
        1. 13.2.1. URL Mapping
        2. 13.2.2. URL Routing
      3. 13.3. The SiteMapPath Control
        1. 13.3.1. Customizing the SiteMapPath
        2. 13.3.2. Using SiteMapPath Styles and Templates
        3. 13.3.3. Adding Custom Site Map Information
      4. 13.4. The TreeView Control
        1. 13.4.1. TreeView Properties
        2. 13.4.2. TreeView Styles
          1. 13.4.2.1. Applying Styles to Node Types
          2. 13.4.2.2. Applying Styles to Node Levels
      5. 13.5. The Menu Control
        1. 13.5.1. Menu Styles
        2. 13.5.2. Menu Templates
      6. 13.6. The Last Word
  9. 4. Working with Data
    1. 14. ADO.NET Fundamentals
      1. 14.1. Understanding Databases
      2. 14.2. Configuring Your Database
        1. 14.2.1. SQL Server Express
        2. 14.2.2. Browsing and Modifying Databases in Visual Studio
        3. 14.2.3. The sqlcmd Command-Line Tool
      3. 14.3. SQL Basics
        1. 14.3.1. Running Queries in Visual Studio
        2. 14.3.2. The Select Statement
          1. 14.3.2.1. A Sample Select Statement
          2. 14.3.2.2. Improving the Select Statement
          3. 14.3.2.3. An Alternative Select Statement
          4. 14.3.2.4. The Where Clause
          5. 14.3.2.5. String Matching with the Like Operator
          6. 14.3.2.6. Aggregate Queries
        3. 14.3.3. The SQL Update Statement
        4. 14.3.4. The SQL Insert Statement
        5. 14.3.5. The SQL Delete Statement
      4. 14.4. The Data Provider Model
      5. 14.5. Direct Data Access
        1. 14.5.1. Creating a Connection
          1. 14.5.1.1. The Connection String
          2. 14.5.1.2. Windows Authentication
          3. 14.5.1.3. User Instance Connections
          4. 14.5.1.4. Storing the Connection String
          5. 14.5.1.5. Making the Connection
        2. 14.5.2. The Select Command
        3. 14.5.3. The DataReader
        4. 14.5.4. Putting It All Together
          1. 14.5.4.1. Filling the List Box
          2. 14.5.4.2. Retrieving the Record
        5. 14.5.5. Updating Data
          1. 14.5.5.1. Displaying Values in Text Boxes
          2. 14.5.5.2. Adding a Record
          3. 14.5.5.3. Creating More Robust Commands
          4. 14.5.5.4. Updating a Record
          5. 14.5.5.5. Deleting a Record
      6. 14.6. Disconnected Data Access
        1. 14.6.1. Selecting Disconnected Data
        2. 14.6.2. Selecting Multiple Tables
        3. 14.6.3. Defining Relationships
      7. 14.7. The Last Word
    2. 15. Data Binding
      1. 15.1. Introducing Data Binding
        1. 15.1.1. Types of ASP.NET Data Binding
          1. 15.1.1.1. Single-Value, or "Simple," Data Binding
          2. 15.1.1.2. Repeated-Value, or "List," Binding
        2. 15.1.2. How Data Binding Works
      2. 15.2. Single-Value Data Binding
        1. 15.2.1. A Simple Data Binding Example
        2. 15.2.2. Simple Data Binding with Properties
        3. 15.2.3. Problems with Single-Value Data Binding
        4. 15.2.4. Using Code Instead of Simple Data Binding
      3. 15.3. Repeated-Value Data Binding
        1. 15.3.1. Data Binding with Simple List Controls
        2. 15.3.2. A Simple List Binding Example
        3. 15.3.3. Strongly Typed Collections
        4. 15.3.4. Multiple Binding
        5. 15.3.5. Data Binding with a Dictionary Collection
        6. 15.3.6. Using the DataValueField Property
        7. 15.3.7. Data Binding with ADO.NET
        8. 15.3.8. Creating a Record Editor
      4. 15.4. Data Source Controls
        1. 15.4.1. The Page Life Cycle with Data Binding
        2. 15.4.2. The SqlDataSource
        3. 15.4.3. Selecting Records
          1. 15.4.3.1. How the Data Source Controls Work
        4. 15.4.4. Parameterized Commands
          1. 15.4.4.1. Other Types of Parameters
          2. 15.4.4.2. Setting Parameter Values in Code
        5. 15.4.5. Handling Errors
        6. 15.4.6. Updating Records
          1. 15.4.6.1. Strict Concurrency Checking
      5. 15.5. The Last Word
    3. 16. The Data Controls
      1. 16.1. The GridView
        1. 16.1.1. Automatically Generating Columns
        2. 16.1.2. Defining Columns
          1. 16.1.2.1. Configuring Columns
          2. 16.1.2.2. Generating Columns with Visual Studio
      2. 16.2. Formatting the GridView
        1. 16.2.1. Formatting Fields
        2. 16.2.2. Using Styles
          1. 16.2.2.1. Configuring Styles with Visual Studio
        3. 16.2.3. Formatting-Specific Values
      3. 16.3. Selecting a GridView Row
        1. 16.3.1. Adding a Select Button
          1. 16.3.1.1. Using a Data Field As a Select Button
        2. 16.3.2. Using Selection to Create Master-Details Pages
      4. 16.4. Editing with the GridView
      5. 16.5. Sorting and Paging the GridView
        1. 16.5.1. Sorting
          1. 16.5.1.1. Sorting and Selecting
        2. 16.5.2. Paging
          1. 16.5.2.1. Paging and Selection
      6. 16.6. Using GridView Templates
        1. 16.6.1. Using Multiple Templates
        2. 16.6.2. Editing Templates in Visual Studio
        3. 16.6.3. Handling Events in a Template
        4. 16.6.4. Editing with a Template
          1. 16.6.4.1. Editing with Validation
          2. 16.6.4.2. Editing Without a Command Column
      7. 16.7. The DetailsView and FormView
        1. 16.7.1. The DetailsView
          1. 16.7.1.1. Defining Fields
        2. 16.7.2. The FormView
      8. 16.8. The Last Word
    4. 17. Files and Streams
      1. 17.1. Files and Web Applications
      2. 17.2. File System Information
        1. 17.2.1. The Path Class
        2. 17.2.2. The Directory and File Classes
          1. 17.2.2.1. Dissecting the Code . . .
        3. 17.2.3. The DirectoryInfo and FileInfo Classes
        4. 17.2.4. The DriveInfo Class
        5. 17.2.5. A Sample File Browser
          1. 17.2.5.1. Dissecting the Code . . .
      3. 17.3. Reading and Writing with Streams
        1. 17.3.1. Text Files
        2. 17.3.2. Binary Files
        3. 17.3.3. Shortcuts for Reading and Writing Files
        4. 17.3.4. A Simple Guest Book
          1. 17.3.4.1. Dissecting the Code . . .
      4. 17.4. Allowing File Uploads
        1. 17.4.1. The FileUpload Control
          1. 17.4.1.1. Dissecting the Code . . .
      5. 17.5. The Last Word
    5. 18. XML
      1. 18.1. XML Explained
        1. 18.1.1. Improving the List with XML
        2. 18.1.2. XML Basics
        3. 18.1.3. Attributes
        4. 18.1.4. Comments
      2. 18.2. The XML Classes
        1. 18.2.1. The XML TextWriter
          1. 18.2.1.1. Dissecting the Code . . .
        2. 18.2.2. The XML Text Reader
          1. 18.2.2.1. Dissecting the Code . . .
        3. 18.2.3. Working with XML Documents in Memory
          1. 18.2.3.1. Dissecting the Code . . .
        4. 18.2.4. Reading an XML Document
        5. 18.2.5. Searching an XML Document
      3. 18.3. XML Validation
        1. 18.3.1. XML Namespaces
          1. 18.3.1.1. Writing XML Content with Namespaces
        2. 18.3.2. XML Schema Definition
          1. 18.3.2.1. Dissecting the Code . . .
        3. 18.3.3. Validating an XML Document
      4. 18.4. XML Display and Transforms
        1. 18.4.1. The Xml Web Control
      5. 18.5. The Last Word
  10. 5. Website Security
    1. 19. Security Fundamentals
      1. 19.1. Understanding Security
        1. 19.1.1. Testing and Deploying Security Settings
      2. 19.2. Authentication and Authorization
      3. 19.3. Forms Authentication
        1. 19.3.1. Web.config Settings
        2. 19.3.2. Authorization Rules
          1. 19.3.2.1. Controlling Access to Specific Directories
          2. 19.3.2.2. Controlling Access to Specific Files
          3. 19.3.2.3. Controlling Access for Specific Users
        3. 19.3.3. The WAT
        4. 19.3.4. The Login Page
          1. 19.3.4.1. Retrieving the User's Identity
          2. 19.3.4.2. Signing Out
          3. 19.3.4.3. Persistent Cookies
      4. 19.4. Windows Authentication
        1. 19.4.1. Web.config Settings
        2. 19.4.2. A Windows Authentication Test
      5. 19.5. The Last Word
    2. 20. Membership
      1. 20.1. The Membership Data Store
        1. 20.1.1. Membership with SQL Server Express
        2. 20.1.2. Using the Full Version of SQL Server
        3. 20.1.3. Configuring the Membership Provider
        4. 20.1.4. Creating Users with the WAT
        5. 20.1.5. The Membership and MembershipUser Classes
        6. 20.1.6. Authentication with Membership
        7. 20.1.7. Disabled Accounts
      2. 20.2. The Security Controls
        1. 20.2.1. The Login Control
        2. 20.2.2. The CreateUserWizard Control
        3. 20.2.3. The PasswordRecovery Control
      3. 20.3. Role-Based Security
        1. 20.3.1. Creating and Assigning Roles
        2. 20.3.2. Restricting Access Based on Roles
        3. 20.3.3. The LoginView Control
      4. 20.4. The Last Word
    3. 21. Profiles
      1. 21.1. Understanding Profiles
        1. 21.1.1. Profile Performance
        2. 21.1.2. How Profiles Store Data
      2. 21.2. Using the SqlProfileProvider
        1. 21.2.1. Enabling Authentication
        2. 21.2.2. Using SQL Server Express
        3. 21.2.3. Using the Full Version of SQL Server
        4. 21.2.4. The Profile Databases
        5. 21.2.5. Defining Profile Properties
        6. 21.2.6. Using Profile Properties
        7. 21.2.7. Profile Serialization
        8. 21.2.8. Profile Groups
        9. 21.2.9. Profiles and Custom Data Types
          1. 21.2.9.1. Dissecting the Code . . .
          2. 21.2.9.2. Custom Type Serialization
          3. 21.2.9.3. Automatic Saves
        10. 21.2.10. The Profile API
        11. 21.2.11. Anonymous Profiles
          1. 21.2.11.1. Migrating Anonymous Profiles
      3. 21.3. The Last Word
  11. 6. Advanced ASP.NET
    1. 22. Component-Based Programming
      1. 22.1. Why Use Components?
      2. 22.2. Component Jargon
        1. 22.2.1. Three-Tier Design
        2. 22.2.2. Encapsulation
        3. 22.2.3. Business Objects
        4. 22.2.4. Data Objects
        5. 22.2.5. Components and Classes
      3. 22.3. Creating a Component
        1. 22.3.1. Classes and Namespaces
        2. 22.3.2. Class Members
        3. 22.3.3. Adding a Reference to the Component
        4. 22.3.4. Using the Component
      4. 22.4. Properties and State
        1. 22.4.1. A Stateful Account Class
        2. 22.4.2. A Stateless AccountUtility Class
      5. 22.5. Data-Access Components
        1. 22.5.1. A Simple Data-Access Component
          1. 22.5.1.1. Dissecting the Code . . .
        2. 22.5.2. Using the Data-Access Component
          1. 22.5.2.1. Dissecting the Code . . .
        3. 22.5.3. Enhancing the Component with Error Handling
        4. 22.5.4. Enhancing the Component with Aggregate Information
      6. 22.6. The ObjectDataSource
        1. 22.6.1. Making Classes the ObjectDataSource Can Understand
        2. 22.6.2. Selecting Records
        3. 22.6.3. Using Method Parameters
        4. 22.6.4. Updating Records
      7. 22.7. The Last Word
    2. 23. Caching
      1. 23.1. Understanding Caching
        1. 23.1.1. When to Use Caching
        2. 23.1.2. Caching in ASP.NET
      2. 23.2. Output Caching
        1. 23.2.1. Caching on the Client Side
        2. 23.2.2. Caching and the Query String
        3. 23.2.3. Caching with Specific Query String Parameters
        4. 23.2.4. A Multiple Caching Example
        5. 23.2.5. Fragment Caching
        6. 23.2.6. Cache Profiles
      3. 23.3. Data Caching
        1. 23.3.1. Adding Items to the Cache
        2. 23.3.2. A Simple Cache Test
        3. 23.3.3. Caching to Provide Multiple Views
        4. 23.3.4. Caching with the Data Source Controls
          1. 23.3.4.1. Caching with SqlDataSource
          2. 23.3.4.2. Caching with ObjectDataSource
      4. 23.4. Caching with Dependencies
        1. 23.4.1. File Dependencies
        2. 23.4.2. Cache Item Dependencies
        3. 23.4.3. SQL Server Cache Dependencies
          1. 23.4.3.1. Enabling the Service Broker
          2. 23.4.3.2. Initializing the Caching Service
          3. 23.4.3.3. Creating the Cache Dependency
      5. 23.5. The Last Word
    3. 24. LINQ and the Entity Framework
      1. 24.1. Understanding LINQ
      2. 24.2. LINQ Basics
        1. 24.2.1.
          1. 24.2.1.1. Dissecting the Code . . .
        2. 24.2.2. LINQ Expressions
          1. 24.2.2.1. Projections
          2. 24.2.2.2. Filtering and Sorting
      3. 24.3. The Entity Framework
        1. 24.3.1. Creating an Entity Data Model
        2. 24.3.2. The Data Model Diagram
        3. 24.3.3. Updating a Data Model
        4. 24.3.4. The Data Model Code
          1. 24.3.4.1. Entities
          2. 24.3.4.2. Contexts
        5. 24.3.5. Querying the Data Model
        6. 24.3.6. Handling Errors
        7. 24.3.7. Navigating Relationships
      4. 24.4. Getting More Advanced with the Entity Framework
        1. 24.4.1. Querying with LINQ to Entities
        2. 24.4.2. Controlling When Data is Loaded
        3. 24.4.3. Updates, Inserts, and Deletes
        4. 24.4.4. Managing Concurrency
      5. 24.5. The EntityDataSource
        1. 24.5.1. Displaying Data
        2. 24.5.2. Editing Data
      6. 24.6. The Last Word
    4. 25. ASP.NET AJAX
      1. 25.1. Understanding Ajax
        1. 25.1.1. Ajax: The Good
        2. 25.1.2. Ajax: The Bad
        3. 25.1.3. The ASP.NET AJAX Toolkit
        4. 25.1.4. The ScriptManager
      2. 25.2. Partial Refreshes
        1. 25.2.1. A Simple UpdatePanel Test
        2. 25.2.2. Handling Errors
        3. 25.2.3. Conditional Updates
        4. 25.2.4. Triggers
      3. 25.3. Progress Notification
        1. 25.3.1. Showing a Simulated Progress Bar
        2. 25.3.2. Cancellation
      4. 25.4. Timed Refreshes
      5. 25.5. The ASP.NET AJAX Control Toolkit
        1. 25.5.1. Installing the ASP.NET AJAX Control Toolkit
        2. 25.5.2. The Accordion
        3. 25.5.3. The AutoCompleteExtender
        4. 25.5.4. Getting More Controls
      6. 25.6. The Last Word
    5. 26. Deploying ASP.NET Applications
      1. 26.1. ASP.NET Applications and the Web Server
        1. 26.1.1. How Web Servers Work
        2. 26.1.2. The Virtual Directory
        3. 26.1.3. Web Application URLs
        4. 26.1.4. Web Farms
      2. 26.2. Internet Information Services (IIS)
        1. 26.2.1. The Many Faces of IIS
        2. 26.2.2. Installing IIS in Windows 7 or Windows Vista
        3. 26.2.3. Installing IIS 7 in Windows Server 2008
      3. 26.3. Managing Websites with IIS Manager
        1. 26.3.1. Creating a Virtual Directory
        2. 26.3.2. Understanding Application Pools
        3. 26.3.3. The ASP.NET Account
          1. 26.3.3.1. Changing the ASP.NET Account
          2. 26.3.3.2. Giving the ASP.NET Account More Privileges
        4. 26.3.4. Configuring a Website
          1. 26.3.4.1. The ASP.NET Configuration Icons
          2. 26.3.4.2. The IIS Configuration Icons
          3. 26.3.4.3. The Management Configuration Icons
        5. 26.3.5. The Default Page
        6. 26.3.6. Custom Error Pages
        7. 26.3.7. The Machine Key
        8. 26.3.8. Windows Authentication
        9. 26.3.9. Confidentiality with SSL and Certificates
          1. 26.3.9.1. Creating a Certificate Request
          2. 26.3.9.2. Implementing SSL
      4. 26.4. Deploying a Simple Site
        1. 26.4.1. Web Applications and Components
        2. 26.4.2. Other Configuration Steps
        3. 26.4.3. Code Compilation
      5. 26.5. Deploying with Visual Studio
        1. 26.5.1. Creating a Virtual Directory for a New Project
        2. 26.5.2. Copying a Website
        3. 26.5.3. Publishing a Website
      6. 26.6. The Last Word

Product information

  • Title: Beginning ASP.NET 4 in C# 2010
  • Author(s):
  • Release date: August 2010
  • Publisher(s): Apress
  • ISBN: 9781430226086