Pro ASP.NET 4 in C# 2010, 4th edition pot

1.6K 13.7K 0
Pro ASP.NET 4 in C# 2010, 4th edition pot

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

MacDonald Freeman Szpuszta FOURTH EDITION ASP.NET 4 in C# 2010 Companion eBook Available 7.5 x 9.25 spine = 3.03125" 1616 page count THE EXPERT’S VOICE ® IN .NET Pro ASP.NET 4 in C# 2010 FOURTH EDITION Matthew MacDonald, Adam Freeman, and Mario Szpuszta Pro this print for content only—size & color not accurate CYAN MAGENTA YELLOW BLACK PANTONE 123 C BOOKS FOR PROFESSIONALS BY PROFESSIONALS ® Matthew MacDonald, Author of Pro Silverlight 4 in C# Beginning ASP.NET 4 in C# 2010 Pro WPF in C# 2010 Pro .NET 2.0 Windows Forms and Custom Controls US $59.99 Shelve in: .NET User level: Intermediate–Advanced www.apress.com SOURCE CODE ONLINE Companion eBook See last page for details on $10 eBook version ISBN 978-1-4302-2529-4 9 781430 225294 5 59 9 9 Adam Freeman, Co-Author of Introducing Visual C# 2010 Pro .NET 4 Parallel Programming in C# Pro LINQ: Language Integrated Query in C# 2010 Visual C# 2010 Recipes Programming .NET Security Microsoft .NET XML Web Services Step by Step C# for Java Developers Programming the Internet with Java Active Java Mario Szpuszta, Co-Author of Advanced .NET Remoting Pro ASP.NET 4 in C# 2010 Dear Reader, As you know, ASP.NET is Microsoft’s premier technology for creating server- side web applications. In this book, you’ll learn about ASP.NET 4, which is the latest milestone in web development. ASP.NET 4 adds a host of refinements and two major new features to pre- vious versions of the technology. The first major change is the inclusion of ASP.NET MVC—an alternative way to design web pages—that offers clean- er URLs, better testability, and tight control over HTML. The second is ASP. NET Dynamic Data—a data scaffolding framework that allows you to build an entire website out of flexible, reusable templates. You’ll learn about both of these innovations in this book. You’ll also get a solid look at Silverlight, Microsoft’s next-generation browser plug-in that allows you to draw vector graphics, show animations, and play media files in your ASP.NET pages. The book also covers: • Core concepts of ASP.NET 4. You’ll learn the fundamentals of Visual Studio, ASP. NET, and the web forms model—and how to extend this infrastructure when you need to. • Data access. You’ll get a thorough review of scalable data access programming, covering pure ADO.NET, LINQ, the Entity Framework, ASP.NET Dynamic Data, and advanced caching techniques. • Security. You’ll learn to secure your website with ASP.NET’s built-in authoriza- tion and authentication features, and how to protect sensitive data wherever it’s stored with encryption. • Advanced user interface. You’ll study a range of techniques for building pages with pizzazz, including CSS, custom controls, GDI+, JavaScript, and ASP.NET AJAX. • And much more… Matthew MacDonald (Microsoft MVP, MCSD) THE APRESS ROADMAP Pro Silverlight 4 in C# Pro Dynamic .NET 4.0 Applications Pro Windows Azure Pro C# 2010 and the .NET 4 Platform Pro ASP.NET 4 in C# 2010, Introducing .NET 4.0 Accelerated C# 2010 2529-4 MacDonald.indd 1 6/7/10 12:08 PM www.it-ebooks.info www.it-ebooks.info Pro ASP.NET 4 in C# 2010 Fourth Edition ■ ■ ■ Matthew MacDonald, Adam Freeman, and Mario Szpuszta www.it-ebooks.info Pro ASP.NET in C# 2010, Fourth Edition Copyright © 2010 by Matthew MacDonald, Adam Freeman, and Mario Szpuszta All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright the publisher. ISBN-13 (pbk): 978-1-4302-2529-4 ISBN-13 (electronic): 978-1-4302-2530-0 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. President and Publisher: Paul Manning Lead Editor: Ewan Buckingham Technical Reviewers: Fabio Claudio Ferracchiati and Todd Meister Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Coordinating Editor: Anne Collett Copy Editors: Ralph Moore, Katie Stence, Kim Wimpsett Compositor: Mary Sudul Indexer: Kevin Broccoli Artist: April Milne Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer Science+Business Media, LLC., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders- ny@springer-sbm.com, or visit www.springeronline.com. For information on translations, please e-mail rights@apress.com, or visit www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at www.apress.com. You will need to answer questions pertaining to this book in order to successfully download the code. www.it-ebooks.info iii Contents at a Glance Contents v About the Author xxxii About the Technical Reviewer xxxiii Introduction xxxiv Part 1: Core Concepts 1 ■ Chapter 1: Introducing ASP.NET 3 ■ Chapter 2: Visual Studio 21 ■ Chapter 3: Web Forms 77 ■ Chapter 4: Server Controls 129 ■ Chapter 5: ASP.NET Applications 183 ■ Chapter 6: State Management 235 Part 2: Data Access 275 ■ Chapter 7: ADO.NET Fundamentals 277 ■ Chapter 8: Data Components and the DataSet 321 ■ Chapter 9: Data Binding 353 ■ Chapter 10: Rich Data Controls 403 ■ Chapter 11: Caching and Asynchronous Pages 477 ■ Chapter 12: Files and Streams 527 ■ Chapter 13: LINQ 563 ■ Chapter 14: XML 617 www.it-ebooks.info iv Part 3: Building ASP.NET Websites 679 ■ Chapter 15: User Controls 681 ■ Chapter 16: Themes and Master Pages 703 ■ Chapter 17: Website Navigation 735 ■ Chapter 18: Website Deployment 791 Part 4: Security 833 ■ Chapter 19: The ASP.NET Security Model 835 ■ Chapter 20: Forms Authentication 851 ■ Chapter 21: Membership 877 ■ Chapter 22: Windows Authentication 933 ■ Chapter 23: Authorization and Roles 963 ■ Chapter 24: Profiles 995 ■ Chapter 25: Cryptography 1029 ■ Chapter 26: Custom Membership Providers 1061 Part 5: Advanced User Interface 1099 ■ Chapter 27: Custom Server Controls 1101 ■ Chapter 28: Graphics, GDI+, and Charting 1135 ■ Chapter 29: JavaScript and Ajax Techniques 1179 ■ Chapter 30: ASP.NET AJAX 1239 ■ Chapter 31: Portals with Web Part Pages 1303 ■ Chapter 32: MVC 1363 ■ Chapter 33: Dynamic Data 1397 ■ Chapter 34: Silverlight 1437 Index 1491 www.it-ebooks.info ■ CONTENTS v Contents Contents at a Glance iii About the Author xxxii About the Technical Reviewer xxxiii Introduction xxxiv Part 1: Core Concepts 1 ■ Chapter 1: Introducing ASP.NET 3 The Seven Pillars of ASP.NET 3 #1: ASP.NET Is Integrated with the .NET Framework 3 #2: ASP.NET Is Compiled, Not Interpreted 4 #3: ASP.NET Is Multilanguage 6 #4: ASP.NET Is Hosted by the Common Language Runtime 8 #5: ASP.NET Is Object-Oriented 9 #6: ASP.NET Supports all Browsers 11 #7: ASP.NET Is Easy to Deploy and Configure 11 The Evolution of ASP.NET 12 ASP.NET 1.0 and 1.1 12 ASP.NET 2.0 12 ASP.NET 3.5 13 ASP.NET 4 16 Silverlight 18 Summary 19 www.it-ebooks.info ■ CONTENTS vi ■ Chapter 2: Visual Studio 21 Introducing Visual Studio 21 Websites and Web Projects 22 Creating a Projectless Website 23 Designing a Web Page 28 The Visual Studio IDE 35 Solution Explorer 37 Document Window 38 Toolbox 38 Error List and Task List 39 Server Explorer 41 The Code Editor 42 Adding Assembly References 43 IntelliSense and Outlining 46 Visual Studio 2010 Improvements 50 The Code Model 56 How Code-Behind Files Are Connected to Pages 59 How Control Tags Are Connected to Page Variables 60 How Events Are Connected to Event Handlers 61 Web Projects 63 Creating a Web Project 64 Migrating a Website from a Previous Version of Visual Studio 66 Visual Studio Debugging 68 Single-Step Debugging 69 Variable Watches 72 Advanced Breakpoints 74 The Web Development Helper 74 Summary 76 ■ Chapter 3: Web Forms 77 Page Processing 78 HTML Forms 78 www.it-ebooks.info ■ CONTENTS vii Dynamic User Interface 80 The ASP.NET Event Model 81 Automatic Postbacks 82 View State 84 XHTML Compliance 88 Client-Side Control IDs 94 Web Forms Processing Stages 97 Page Framework Initialization 98 User Code Initialization 99 Validation 99 Event Handling 100 Automatic Data Binding 100 Cleanup 101 A Page Flow Example 101 The Page As a Control Container 104 Showing the Control Tree 104 The Page Header 109 Dynamic Control Creation 110 The Page Class 112 Session, Application, and Cache 112 Request 113 Response 114 Server 118 User 121 Trace 121 Accessing the HTTP Context in Another Class 127 Summary 128 ■ Chapter 4: Server Controls 129 Types of Server Controls 129 The Server Control Hierarchy 130 HTML Server Controls 132 The HtmlControl Class 133 www.it-ebooks.info ■ CONTENTS viii The HtmlContainerControl Class 133 The HtmlInputControl Class 134 The HTML Server Control Classes 134 Setting Style Attributes and Other Properties 136 Programmatically Creating Server Controls 137 Handling Server-Side Events 139 Web Controls 142 The WebControl Base Class 143 Basic Web Control Classes 145 Units 147 Enumerations 147 Colors 148 Fonts 148 Focus 150 The Default Button 151 Scrollable Panels 152 Handling Web Control Events 153 The List Controls 156 The Selectable List Controls 157 The BulletedList Control 161 Input Validation Controls 162 The Validation Controls 163 The Validation Process 164 The BaseValidator Class 165 The RequiredFieldValidator Control 167 The RangeValidator Control 167 The CompareValidator Control 168 The RegularExpressionValidator Control 168 The CustomValidator Control 171 The ValidationSummary Control 172 Using the Validators Programmatically 174 Validation Groups 175 www.it-ebooks.info [...]... . 144 1 Creating a Silverlight Solution 144 2 Silverlight Compilation . 144 3 The Entry Page 144 5 Creating a Silverlight Project . 144 9 Designing a Silverlight Page 145 0 Understanding XAML 145 4 Setting Properties 145 5 The XAML Code-Behind 145 6 Handling Events 145 7 xxx www.it-ebooks.info... CONTENTS Editing Templates in Visual Studio .43 6 Binding to a Method 43 7 Handling Events in a Template 43 9 Editing with a Template 44 0 Client IDs in Templates .44 7 The ListView 44 7 Grouping .45 1 Paging .45 3 The DetailsView and FormView 45 4 The DetailsView 45 4 The FormView... Dynamic Data Project 140 3 Customizing a Dynamic Data Site 140 4 Customizing with Templates 140 4 Customizing with Routes 141 4 Customizing with Metadata 142 3 Customizing Validation . 143 0 Summary 143 5 ■ Chapter 34: Silverlight 143 7 Understanding Silverlight 143 8 Silverlight vs Flash 143 9 Silverlight... 45 7 Advanced Grids 45 9 Summaries in the GridView 45 9 A Parent/Child View in a Single Table 46 1 Editing a Field Using a Lookup Table 46 4 Serving Images from a Database .46 6 Detecting Concurrency Conflicts 47 2 Summary .47 6 ■ Chapter 11: Caching and Asynchronous Pages .47 7 Understanding ASP.NET Caching ... Caching .47 7 Output Caching 47 8 Declarative Output Caching 47 9 Caching and the Query String 48 0 Caching with Specific Query String Parameters .48 1 Custom Caching Control .48 1 Caching with the HttpCachePolicy Class 48 3 Post-Cache Substitution and Fragment Caching 48 4 Cache Profiles 48 7 Cache Configuration... Mechanisms for Windows Authentication 935 Implementing Windows Authentication . 942 Configuring IIS 7.x 942 Configuring ASP.NET 944 Deeper Into the IIS 7.x Pipeline 945 Denying Access to Anonymous Users 948 Accessing Windows User Information 950 Impersonation 956 Impersonation and Delegation in Windows ... dozen books about NET programming, including Pro Silverlight 3 in C# (Apress, 2009), Pro WPF in C# 2010 (Apress, 2010), and Beginning ASP.NET 4 in C# 2010 (Apress, 2010) He lives in Toronto with his wife and two daughters ■ Adam Freeman is an experienced IT professional who has held senior positions in a range of companies, most recently chief technology officer and chief operating officer of a global... Chapter 24: Profiles 995 Understanding Profiles 995 Profile Performance 996 How Profiles Store Data 997 Profiles and Authentication 998 Profiles vs Custom Data Components .998 Using the SqlProfileProvider 998 Creating the Profile Tables 999 Configuring the Provider 1002 Defining Profile Properties... 42 3 Sorting and Selection 42 5 Advanced Sorting .42 5 Paging the GridView 42 7 Automatic Paging .42 7 Paging and Selection 42 9 Custom Pagination with the ObjectDataSource 42 9 Customizing the Pager Bar 43 2 GridView Templates 43 3 Using Multiple Templates 43 5 xiii www.it-ebooks.info... 337 Filling a DataSet 338 Working with Multiple Tables and Relationships 340 Searching for Specific Rows 343 Using the DataSet in a Data Access Class 344 Data Binding . 345 The DataView Class . 345 Sorting with a DataView . 346 Filtering with a DataView 348 Advanced Filtering with Relationships . Silverlight 4 in C# Pro Dynamic .NET 4. 0 Applications Pro Windows Azure Pro C# 2010 and the .NET 4 Platform Pro ASP. NET 4 in C# 2010, Introducing .NET 4. 0 Accelerated. FOR PROFESSIONALS BY PROFESSIONALS ® Matthew MacDonald, Author of Pro Silverlight 4 in C# Beginning ASP. NET 4 in C# 2010 Pro WPF in C# 2010 Pro .NET

Ngày đăng: 06/03/2014, 20:21

Từ khóa liên quan

Mục lục

  • Prelim

  • Contents at a Glance

  • Contents

  • About the Authors

  • About the Technical Reviewers

  • Introduction

    • What Does This Book Cover?

    • Who Is This Book For?

    • What Do You Need to Use This Book?

    • Customer Support

  • Part 1: Core Concepts

    • Introducing ASP.NET

      • The Seven Pillars of ASP.NET

        • #1: ASP.NET Is Integrated with the .NET Framework

        • #2: ASP.NET Is Compiled, Not Interpreted

        • #3: ASP.NET Is Multilanguage

        • #4: ASP.NET Is Hosted by the Common Language Runtime

        • #5: ASP.NET Is Object-Oriented

        • #6: ASP.NET Supports all Browsers

        • #7: ASP.NET Is Easy to Deploy and Configure

      • The Evolution of ASP.NET

        • ASP.NET 1.0 and 1.1

        • ASP.NET 2.0

        • ASP.NET 3.5

        • LINQ

        • ASP.NET AJAX

        • ASP.NET 4

        • ASP.NET MVC

        • ASP.NET Dynamic Data

        • Silverlight

      • Summary

    • Visual Studio

      • Introducing Visual Studio

        • Websites and Web Projects

        • Creating a Projectless Website

        • The Development Language

        • The Framework Version

        • The Template

        • The Location

        • Designing a Web Page

        • Absolute Positioning

        • Smart Tags

        • Static HTML Tags

        • HTML Tables

        • Structuring HTML Markup

      • The Visual Studio IDE

        • Solution Explorer

        • Document Window

        • Toolbox

        • Error List and Task List

        • Server Explorer

      • The Code Editor

        • Adding Assembly References

        • IntelliSense and Outlining

        • Outlining

        • Member List

        • Error Underlining

        • Visual Studio 2010 Improvements

        • IntelliSense Gets More Intelligent

        • New Tools for Search and Navigation

        • Draggable Document Windows

      • The Code Model

        • How Code-Behind Files Are Connected to Pages

        • How Control Tags Are Connected to Page Variables

        • How Events Are Connected to Event Handlers

      • Web Projects

        • Project-Based Development

        • Creating a Web Project

        • Migrating a Website from a Previous Version of Visual Studio

      • Visual Studio Debugging

        • Single-Step Debugging

        • Variable Watches

        • Advanced Breakpoints

      • The Web Development Helper

      • Summary

    • Web Forms

      • Page Processing

        • HTML Forms

        • Dynamic User Interface

        • The ASP.NET Event Model

        • Automatic Postbacks

        • Automatic Postbacks “Under the Hood”

        • View State

        • View State “Under the Hood”

        • View State Chunking

        • XHTML Compliance

        • Document Type Definitions

        • Configuring XHTML Rendering

        • Visual Studio’s Default Doctype

        • XHTML Validation

        • Client-Side Control IDs

      • Web Forms Processing Stages

        • Page Framework Initialization

        • User Code Initialization

        • Validation

        • Event Handling

        • Automatic Data Binding

        • Cleanup

        • A Page Flow Example

      • The Page As a Control Container

        • Showing the Control Tree

        • The Page Header

        • Dynamic Control Creation

      • The Page Class

        • Session, Application, and Cache

        • Request

        • Response

        • Moving Between Pages

        • Server

        • HTML and URL Encoding

        • User

        • Trace

        • Application Tracing

        • Tracing with the Web Development Helper

        • Accessing the HTTP Context in Another Class

      • Summary

    • Server Controls

      • Types of Server Controls

        • The Server Control Hierarchy

      • HTML Server Controls

        • The HtmlControl Class

        • The HtmlContainerControl Class

        • The HtmlInputControl Class

        • The HTML Server Control Classes

        • Setting Style Attributes and Other Properties

        • Programmatically Creating Server Controls

        • Handling Server-Side Events

        • The ServerClick and ServerChange Events

      • Web Controls

        • The WebControl Base Class

        • Basic Web Control Classes

        • Units

        • Enumerations

        • Colors

        • Fonts

        • Focus

        • The Default Button

        • Scrollable Panels

        • Handling Web Control Events

        • The Click Event and the ImageButton Control

      • The List Controls

        • The Selectable List Controls

        • The BulletedList Control

      • Input Validation Controls

        • The Validation Controls

        • The Validation Process

        • The BaseValidator Class

        • The RequiredFieldValidator Control

        • The RangeValidator Control

        • The CompareValidator Control

        • The RegularExpressionValidator Control

        • The CustomValidator Control

        • The ValidationSummary Control

        • Using the Validators Programmatically

        • Validation Groups

      • Rich Controls

        • The AdRotator Control

        • The Calendar Control

      • Summary

    • ASP.NET Applications

      • Anatomy of an ASP.NET Application

        • The Application Domain

        • Application Lifetime

        • Application Updates

        • Application Directory Structure

      • The global.asax Application File

        • Application Events

        • Demonstrating Application Events

      • ASP.NET Configuration

        • The machine.config File

        • <machineKey>

        • The web.config File

        • Configuration Inheritance

        • Using <location> Elements

        • <system.web>

        • <system.webServer>

        • <appSettings>

        • <connectionStrings>

        • Reading and Writing Configuration Sections Programmatically

        • The Website Administration Tool (WAT)

        • Extending the Configuration File Structure

        • Creating a Section Class

        • Registering a Section Class

        • Encrypting Configuration Sections

        • Programmatic Encryption

        • Command-Line Encryption

      • .NET Components

        • Creating a Component

        • Using a Component Through the App_Code Directory

        • Using a Component Through the Bin Directory

      • Extending the HTTP Pipeline

        • HTTP Handlers

        • Creating a Custom HTTP Handler

        • Configuring a Custom HTTP Handler

        • Using Configuration-Free HTTP Handlers

        • Creating an Advanced HTTP Handler

        • Creating an HTTP Handler for Non-HTML Content

        • HTTP Modules

        • Creating a Custom HTTP Module

      • Summary

    • State Management

      • ASP.NET State Management

      • View State

        • A View State Example

        • Storing Objects in View State

        • Assessing View State

        • Selectively Disabling View State

        • View State Security

      • Transferring Information Between Pages

        • The Query String

        • Using the Query String

        • URL Encoding

        • Cross-Page Posting

        • Getting Page-Specific Information

        • Performing Cross-Page Posting in Any Event Handler

        • The IsPostBack and IsCrossPagePostBack Properties

        • Cross-Page Posting and Validation

      • Cookies

      • Session State

        • Session Architecture

        • Using Session State

        • Configuring Session State

        • Mode

        • Compression

        • Cookieless

        • Timeout

        • Securing Session State

      • Application State

        • Static Application Variables

      • Summary

  • Part 2: Data Access

    • ADO.NET Fundamentals

      • The ADO.NET Architecture

        • ADO.NET Data Providers

        • Standardization in ADO.NET

        • Fundamental ADO.NET Classes

      • The Connection Class

        • Connection Strings

        • User Instance Connections

        • Testing a Connection

        • Connection Pooling

      • The Command and DataReader Classes

        • Command Basics

        • The DataReader Class

        • The ExecuteReader() Method and the DataReader

        • Null Values

        • CommandBehavior

        • Processing Multiple Result Sets

        • The ExecuteScalar() Method

        • The ExecuteNonQuery() Method

        • SQL Injection Attacks

        • Using Parameterized Commands

        • Calling Stored Procedures

      • Transactions

        • Transactions and ASP.NET Applications

        • Stored Procedure Transactions

        • Client-Initiated ADO.NET Transactions

        • Isolation Levels

        • Savepoints

      • Provider-Agnostic Code

        • Creating the Factory

        • Create Objects with Factory

        • A Query with Provider-Agnostic Code

      • Summary

    • Data Components and the DataSet

      • Building a Data Access Component

        • The Data Package

        • The Stored Procedures

        • The Data Utility Class

        • Concurrency Strategies

        • Testing the Database Component

      • Disconnected Data

        • Web Applications and the DataSet

        • XML Integration

      • The DataSet

      • The DataAdapter Class

        • Filling a DataSet

        • Working with Multiple Tables and Relationships

        • Searching for Specific Rows

        • Using the DataSet in a Data Access Class

        • Data Binding

      • The DataView Class

        • Sorting with a DataView

        • Filtering with a DataView

        • Advanced Filtering with Relationships

        • Calculated Columns

      • Summary

    • Data Binding

      • Basic Data Binding

        • Single-Value Binding

        • Other Types of Expressions

        • Custom Expression Builders

        • Repeated-Value Binding

        • Binding to a DataReader

        • The Rich Data Controls

        • Binding to a DataView

      • Data Source Controls

        • The Page Life Cycle with Data Binding

      • The SqlDataSource

        • Selecting Records

        • Data Binding “Under the Hood”

        • Parameterized Commands

        • Stored Procedures

        • More Parameter Types

        • Handling Errors

        • Updating Records

        • Strict Concurrency Checking

        • Updating with Stored Procedures

        • Deleting Records

        • Inserting Records

        • Disadvantages of the SqlDataSource

      • The ObjectDataSource

        • Selecting Records

        • Using a Parameterized Constructor

        • Using Method Parameters

        • Updating Records

        • Updating with a Data Object

        • Dealing with Nonstandard Method Signatures

        • Handling Identity Values in an Insert

      • The Limits of the Data Source Controls

        • The Problem

        • Adding the Extra Items

        • Handling the Extra Options with the SqlDataSource

        • Handling the Extra Options with the ObjectDataSource

      • Summary

    • Rich Data Controls

      • The GridView

        • Defining Columns

      • Formatting the GridView

        • Formatting Fields

        • Styles

        • Defining Styles

        • Configuring Styles with Visual Studio

        • Formatting-Specific Values

      • GridView Row Selection

        • Using Selection to Create a Master-Details Form

        • The SelectedIndexChanged Event

        • Using a Data Field As a Select Button

      • Sorting the GridView

        • Sorting with the SqlDataSource

        • Sorting with the ObjectDataSource

        • Sorting and Selection

        • Advanced Sorting

      • Paging the GridView

        • Automatic Paging

        • Paging and Selection

        • Custom Pagination with the ObjectDataSource

        • Counting the Records

        • A Stored Procedure to Get Paged Records

        • The Paged Selection Method

        • Customizing the Pager Bar

      • GridView Templates

        • Using Multiple Templates

        • Editing Templates in Visual Studio

        • Binding to a Method

        • Handling Events in a Template

        • Editing with a Template

        • Editing with Advanced Controls

        • Editing Without a Command Column

        • Client IDs in Templates

      • The ListView

        • Grouping

        • Paging

      • The DetailsView and FormView

        • The DetailsView

        • Defining Fields

        • Record Operations

        • The FormView

      • Advanced Grids

        • Summaries in the GridView

        • A Parent/Child View in a Single Table

        • Editing a Field Using a Lookup Table

        • Serving Images from a Database

        • Displaying Binary Data

        • Reading Binary Data Efficiently

        • Integrating Images with Other Content

        • Detecting Concurrency Conflicts

      • Summary

    • Caching and Asynchronous Pages

      • Understanding ASP.NET Caching

      • Output Caching

        • Declarative Output Caching

        • Caching and the Query String

        • Caching with Specific Query String Parameters

        • Custom Caching Control

        • Caching with the HttpCachePolicy Class

        • Post-Cache Substitution and Fragment Caching

        • Fragment Caching

        • Post-Cache Substitution

        • Cache Profiles

        • Cache Configuration

        • Output Caching Extensibility

        • Building a Custom Cache Provider

        • Using a Custom Cache Provider

      • Data Caching

        • Adding Items to the Cache

        • A Simple Cache Test

        • Cache Priorities

        • Caching with the Data Source Controls

        • Caching with SqlDataSource

        • Caching with ObjectDataSource

      • Cache Dependencies

        • File and Cache Item Dependencies

        • Aggregate Dependencies

        • The Item Removed Callback

        • Understanding SQL Cache Notifications

        • How Cache Notifications Work

        • Enabling Notifications

        • Creating the Cache Dependency

      • Custom Cache Dependencies

        • A Basic Custom Cache Dependency

        • A Custom Cache Dependency Using Message Queues

      • Asynchronous Pages

        • Creating an Asynchronous Page

        • Querying Data in an Asynchronous Page

        • Handling Errors

        • Using Caching with Asynchronous Tasks

        • Multiple Asynchronous Tasks and Timeouts

      • Summary

    • Files and Streams

      • Working with the File System

        • The Directory and File Classes

        • The DirectoryInfo and FileInfo Classes

        • The DriveInfo Class

        • Working with Attributes

        • Filter Files with Wildcards

        • Retrieving File Version Information

        • The Path Class

        • A File Browser

      • Reading and Writing Files with Streams

        • Text Files

        • Binary Files

        • Uploading Files

        • Making Files Safe for Multiple Users

        • Creating Unique Filenames

        • Locking File Access Objects

        • Compression

      • Serialization

      • Summary

    • LINQ

      • LINQ Basics

        • Deferred Execution

        • How LINQ Works

        • LINQ Expressions

        • Projections

        • Filtering and Sorting

        • Grouping and Aggregation

        • LINQ Expressions “Under the Hood”

        • Extension Methods

        • Lambda Expressions

        • Multipart Expressions

      • LINQ to DataSet

        • Typed DataSets

        • Null Values

      • LINQ to Entities

        • Generating the Data Model

        • The Data Model Classes

        • The Derived Object Context Class

        • The Entity Classes

        • Entity Relationships

        • One-to-Many Relationships

        • One-to-One Relationships

        • Querying Stored Procedures

        • LINQ to Entities Queries “Under the Hood”

        • Filtering Too Late

        • Using Lazy and Eager Data Loading

        • Using Explicit Loading

        • Compiling Queries

      • Database Operations

        • Inserts

        • Creating Partially Populated Entity Classes

        • Inserting Associated Entities

        • Updates

        • Deletes

        • Managing Concurrency

        • Handling Concurrency Conflicts

      • The EntityDataSource Control

        • Displaying Data

        • Getting Related Data

        • Editing Data

        • Validation

      • Using the QueryExtender Control

        • Using a SearchExpression

        • Using a RangeExpression

        • Using a PropertyExpression

        • Using a MethodExpression

      • Summary

    • XML

      • When Does Using XML Make Sense?

      • An Introduction to XML

        • The Advantages of XML

        • Well-Formed XML

        • XML Namespaces

        • XML Schemas

      • Stream-Based XML Processing

        • Writing XML Files

        • Reading XML Files

      • In-Memory XML Processing

        • The XmlDocument

        • The XPathNavigator

        • The XDocument

        • Creating XML with XDocument

        • Reading XML with XDocument

        • Namespaces

      • Searching XML Content

        • Searching with XmlDocument

        • Searching XmlDocument with XPath

        • Searching XDocument with LINQ

      • Validating XML Content

        • A Basic Schema

        • Validating with XmlDocument

        • Validating with XDocument

      • Transforming XML Content

        • A Basic Stylesheet

        • Using XslCompiledTransform

        • Using the Xml Control

        • Transforming XML with LINQ to XML

      • XML Data Binding

        • Nonhierarchical Binding

        • Using XPath

        • Nested Grids

        • Hierarchical Binding with the TreeView

        • Using XSLT

        • Binding to XML Content from Other Sources

        • Updating XML Through the XmlDataSource

      • XML and the ADO.NET DataSet

        • Converting the DataSet to XML

        • Accessing a DataSet As XML

      • Summary

  • Part 3: Building ASP.NET Websites

    • User Controls

      • User Control Basics

        • Creating a Simple User Control

        • Converting a Page to a User Control

      • Adding Code to a User Control

        • Handling Events

        • Adding Properties

        • Using Custom Objects

        • Adding Events

        • Exposing the Inner Web Control

      • Dynamically Loading User Controls

        • Portal Frameworks

      • Partial Page Caching

        • VaryByControl

        • Sharing Cached Controls

      • Summary

    • Themes and Master Pages

      • Cascading Style Sheets

        • Creating a Stylesheet

        • Applying Stylesheet Rules

      • Themes

        • Theme Folders and Skins

        • Applying a Simple Theme

        • Handling Theme Conflicts

        • Creating Multiple Skins for the Same Control

        • Skins with Templates and Images

        • Using CSS in a Theme

        • Applying Themes Through a Configuration File

        • Applying Themes Dynamically

      • Standardizing Website Layout

      • Master Page Basics

        • A Simple Master Page

        • A Simple Content Page

        • Default Content

        • Master Pages with Tables and CSS Layout

        • Master Pages and Relative Paths

        • Applying Master Pages Through a Configuration File

      • Advanced Master Pages

        • Interacting with the Master Page Class

        • Dynamically Setting a Master Page

        • Nesting Master Pages

      • Summary

    • Website Navigation

      • Pages with Multiple Views

        • The MultiView Control

        • The Wizard Control

        • Wizard Steps

        • Wizard Events

        • Wizard Styles, Templates, and Layout

      • Site Maps

        • Defining a Site Map

        • Binding to a Site Map

        • Breadcrumbs

        • Showing a Portion of the Site Map

        • Skipping the Root Node

        • Starting from the Current Node

        • Starting from a Specific Node

        • The Site Map Objects

        • Adding Custom Site Map Information

        • Creating a Custom SiteMapProvider

        • Storing Site Map Information in a Database

        • Creating the Site Map Provider

        • Adding Sorting

        • Adding Caching

        • Security Trimming

      • URL Mapping and Routing

        • URL Mapping

        • URL Routing

      • The TreeView Control

        • The TreeNode

        • Populating Nodes on Demand

        • TreeView Styles

        • Applying Styles to Node Types

        • Applying Styles to Node Levels

        • TreeView Images

      • The Menu Control

        • Menu Styles

        • Menu Templates

      • Summary

    • Website Deployment

      • Installing and Configuring IIS

        • Installing IIS 7

        • Managing IIS 7

      • Deploying a Website

        • Deploying by Copying Files

        • Preparing IIS

        • The Website

        • Deploying the Website

        • Configuring the Deployment

        • Using Web Deployment

        • Preparing IIS

        • The Website

        • Transforming web.config

        • Publishing Databases

        • Deploying the Website

        • Using FTP Deployment

        • Preparing IIS

        • The Website

        • Deploying the Website

        • Variation: Deploying a Project-less Website

      • Managing a Website

        • Creating a New Site

        • Creating Virtual Directories

        • Using the VirtualPathProvider

        • Using Application Pools

        • Creating a New Application Pool

        • Assigning an Application to an Application Pool

        • Starting and Stopping an Application Pool

        • Using Side-by-Side Execution

        • Using Application Warm-Up

        • Preparing IIS 7

        • Configuring Application Warm-Up

      • Extending the Integrated Pipeline

        • Creating the Handler

        • Deploying the Handler

        • Configuring the Handler

        • Testing the Handler

      • Summary

  • Part 4: Security

    • The ASP.NET Security Model

      • What It Means to Create Secure Software

        • Understanding Potential Threats

        • Secure Coding Guidelines

        • Understanding Gatekeepers

      • Understanding the Levels of Security

        • Authentication

        • Impersonation

        • Authorization

        • Confidentiality and Integrity

        • Pulling It All Together

      • Understanding Secure Sockets Layer

        • Understanding Certificates

        • Understanding SSL

        • Configuring SSL in IIS 7.x

        • Configuring Bindings for SSL

        • Encoding Information with SSL

      • Summary

    • Forms Authentication

      • Introducing Forms Authentication

        • Why Use Forms Authentication?

        • Controlling the Authentication Code

        • Controlling the Appearance of the Login Form

        • Working with a Range of Browsers

        • Storing User Information

        • Why Would You Not Use Forms Authentication?

        • Creating Your Own Login Interface

        • Maintaining User Details

        • Intercepting Network Traffic

        • Why Not Implement Cookie Authentication Yourself?

        • Keeping the Authentication Cookie Secure

        • Forms Authentication Is Well Tested

        • Integrating with the ASP.NET Security Framework

        • The Forms Authentication Classes

      • Implementing Forms Authentication

        • Configuring Forms Authentication

        • Credentials Store in web.config

        • Denying Access to Anonymous Users

        • Creating a Custom Login Page

        • Logging Out

        • Hashing Passwords in web.config

        • Cookieless Forms Authentication

        • Custom Credentials Store

        • Persistent Cookies in Forms Authentication

      • IIS 7.x and Forms Authentication

      • Summary

    • Membership

      • Introducing the ASP.NET Membership API

      • Using the Membership API

        • Configuring Forms Authentication

        • Creating the Data Store

        • Database Scripts for ASP.NET Services

        • File-Based SQL Server Store

        • Configuring Connection String and Membership Provider

        • Creating and Authenticating Users

      • Using the Security Controls

        • The Login Control

        • Templates and the Login Control

        • Programming the Login Control

        • The LoginStatus Control

        • The LoginView Control

        • The PasswordRecovery Control

        • PasswordRecovery Templates

        • The ChangePassword Control

        • The CreateUserWizard Control

      • Configuring Membership in IIS 7.x

        • Configuring Providers and Users

        • Using the Membership API with Other Applications

      • Using the Membership Class

        • Retrieving Users from the Store

        • Updating Users in the Store

        • Creating and Deleting Users

        • Validating Users

      • Summary

    • Windows Authentication

      • Introducing Windows Authentication

        • Why Use Windows Authentication?

        • Why Would You Not Use Windows Authentication?

        • Mechanisms for Windows Authentication

        • Basic Authentication

        • Digest Authentication

        • Integrated Windows Authentication

      • Implementing Windows Authentication

        • Configuring IIS 7.x

        • Configuring ASP.NET

        • Deeper Into the IIS 7.x Pipeline

        • Denying Access to Anonymous Users

        • Accessing Windows User Information

        • The WindowsPrincipal Class

        • The WindowsIdentity Class

        • IdentityReference and Role Information

      • Impersonation

        • Impersonation and Delegation in Windows

        • Configured Impersonation

        • Programmatic Impersonation

        • Getting a Token

        • Performing the Impersonation

      • Summary

    • Authorization and Roles

      • URL Authorization

        • Authorization Rules

        • Controlling Access for Specific Users

        • Controlling Access to Specific Directories

        • Controlling Access to Specific Files

        • Controlling Access for Specific Roles

      • File Authorization

      • Authorization Checks in Code

        • Using the IsInRole() Method

        • Using the PrincipalPermission Class

        • Merging PrincipalPermission Objects

        • Using the PrincipalPermission Attribute

      • Using the Roles API for Role-Based Authorization

        • Using the LoginView Control with Roles

        • Accessing Roles Programmatically

        • Using the Roles API with Windows Authentication

      • Authorization and Roles in IIS 7.x

        • Authorization with ASP.NET Roles in IIS 7.x

        • Managing ASP.NET Roles with IIS 7.x

      • Summary

    • Profiles

      • Understanding Profiles

        • Profile Performance

        • How Profiles Store Data

        • Profiles and Authentication

        • Profiles vs. Custom Data Components

      • Using the SqlProfileProvider

        • Creating the Profile Tables

        • Configuring the Provider

        • Defining Profile Properties

        • Using Profile Properties

        • Profile Serialization

        • Profile Groups

        • Profiles and Custom Data Types

        • Custom Type Serialization

        • Automatic Saves

        • The Profiles API

        • Anonymous Profiles

        • Migrating Anonymous Profiles

      • Custom Profile Providers

        • The Custom Profile Provider Classes

        • Designing the FactoredProfileProvider

        • Coding the FactoredProfileProvider

        • Initialization

        • Reading Profile Information

        • Updating Profile Information

        • Testing the FactoredProfileProvider

      • Summary

    • Cryptography

      • Encrypting Data: Confidentiality Matters

      • The .NET Cryptography Namespace

      • Understanding the .NET Cryptography Classes

        • Symmetric Encryption Algorithms

        • Asymmetric Encryption

        • The Abstract Encryption Classes

        • The ICryptoTransform Interface

        • The CryptoStream Class

      • Encrypting Sensitive Data

        • Managing Secrets

        • Using Symmetric Algorithms

        • Using the SymmetricEncryptionUtility Class

        • Using Asymmetric Algorithms

        • Encrypting Sensitive Data in a Database

      • Encrypting the Query String

        • Wrapping the Query String

        • Creating a Test Page

      • Summary

    • Custom Membership Providers

      • Architecture of Custom Providers

      • Basic Steps for Creating Custom Providers

        • Overall Design of the Custom Provider

        • Designing and Implementing the Custom Store

        • Implementing the Provider Classes

        • Creating Users and Adding Them to the Store

        • Validating Users on Login

        • Using Salted Password Hashes

        • The Remaining Functions of the Provider

        • Implementing the XmlRoleProvider

        • Using the Custom Provider Classes

        • Debugging Using the WAT

        • Using Custom Providers with IIS 7.x

      • Summary

  • Part 5: Advanced User Interface

    • Custom Server Controls

      • Custom Server Control Basics

        • Creating a Bare-Bones Custom Control

        • Using a Custom Control

        • Custom Controls in the Toolbox

        • Creating a Web Control That Supports Style Properties

        • The Rendering Process

      • Dealing with Different Browsers

        • The HtmlTextWriter

        • Browser Detection

        • Browser Properties

        • Overriding Browser Type Detection

        • Adaptive Rendering

      • Control State and Events

        • View State

        • Control State

        • Postback Data and Change Events

        • Triggering a Postback

      • Extending Existing Web Controls

        • Composite Controls

        • Derived Controls

        • Creating a Label for Specific Data

      • Summary

    • Graphics, GDI+, and Charting

      • The ImageMap Control

        • Creating Hotspots

        • Handling Hotspot Clicks

        • A Custom Hotspot

      • Drawing with GDI+

        • Simple Drawing

        • Image Format and Quality

        • The Graphics Class

        • Using a GraphicsPath

        • Pens

        • Brushes

      • Embedding Dynamic Graphics in a Web Page

        • Using the PNG Format

        • Passing Information to Dynamic Images

        • Custom Controls That Use GDI+

        • The Custom Control Class

        • The Rendering Page

      • Using the Chart Control

        • Creating a Basic Chart

        • Populating a Chart with Data

        • Binding to a Database Table

        • Binding to a Object DataSource

        • Binding to an XML File

        • Binding to LINQ

      • Summary

    • JavaScript and Ajax Techniques

      • JavaScript Essentials

        • The HTML Document Object Model

        • Client-Side Events

        • Adding JavaScript Attributes Declaratively

        • The OnClientClick Property

        • Script Blocks

        • Manipulating HTML Elements

        • Debugging JavaScript

      • Basic JavaScript Examples

        • Creating a JavaScript Page Processor

        • Using JavaScript to Download Images Asynchronously

        • Rendering Script Blocks

      • Script Injection Attacks

        • Request Validation

        • Disabling Request Validation

        • Extending Request Validation

      • Custom Controls with JavaScript

        • Pop-Up Windows

        • Rollover Buttons

      • Frames

        • Frame Navigation

        • Inline Frames

      • Understanding Ajax

        • The XMLHttpRequest Object

        • Sending a Request

        • Handling the Response

        • An Ajax Example

      • Using Ajax with Client Callbacks

        • Creating a Client Callback

        • Building the Basic Page

        • Implementing the Callback

        • Writing the Client-Side Script

        • Disabling Event Validation

        • Client Callbacks “Under the Hood”

        • Client Callbacks in Custom Controls

        • The DynamicPanel

        • The DynamicPanelRefreshLink

        • The Client Page

      • Summary

    • ASP.NET AJAX

      • Introducing ASP.NET AJAX

        • ASP.NET AJAX on the Client: The Script Libraries

        • ASP.NET AJAX on the Server: The ScriptManager

      • Server Callbacks

        • Web Services in ASP.NET AJAX

        • Creating the Web Service

        • Creating the Web Method

        • Calling the Web Service

        • Placing a Web Method in a Page

        • ASP.NET AJAX Application Services

        • Authentication Service

        • Role Service

        • Profile Service

      • ASP.NET AJAX Server Controls

        • Partial Rendering with the UpdatePanel

        • Handling Errors

        • Conditional Updates

        • Interrupted Updates

        • Triggers

        • Optimizing the UpdatePanel

        • Timed Refreshes with the Timer

        • Time-Consuming Updates with UpdateProgress

        • Cancellation

        • Managing Browser History

        • Adding History Points

        • Restoring Page State

        • How State Is Stored in the URL

      • Deeper into the Client Libraries

        • Understanding the Client Model

        • Object-Oriented Programming in JavaScript

        • Closures

        • Prototypes

        • Registering Classes with ASP.NET AJAX

        • Base Types

        • Namespaces

        • Inheritance

        • Interfaces

        • The Web-Page Framework

        • The Application Class

        • The PageRequestManager Class

        • A Client-Side AJAX Control

      • Control Extenders

        • Installing the ASP.NET AJAX Control Toolkit

        • The AutoCompleteExtender

        • The ASP.NET AJAX Control Toolkit

      • Summary

    • Portals with Web Part Pages

      • Typical Portal Pages

      • Basic Web Part Pages

        • Creating the Page Design

        • WebPartManager and WebPartZone Controls

        • Adding Web Parts to the Page

        • Customizing the Page

      • Creating Web Parts

        • Simple Web Part Tasks

        • Implementing the IWebPart Interface

        • Developing Advanced Web Parts

        • Before You Start: Creating Typed DataSets

        • The Custom WebPart’s Skeleton

        • Initializing the Web Part

        • Loading Data and Processing Events

        • The Final Rendering

        • More Customization Steps

        • Using the Web Part

        • Web Part Editors

        • Creating a Custom Editor

        • Connecting Web Parts

        • Defining the Communication Contract

        • Implementing the Provider Web Part

        • Creating the Consumer Web Part

        • Static Connections Between Web Parts

        • Dynamically Configuring Connection Points

        • Multiple Connection Points

        • Custom Verbs and Web Parts

        • User Controls and Advanced Web Parts

        • Uploading Web Parts Dynamically

        • Authorizing Web Parts

        • Final Tasks for Personalization

        • Clearing Personalization

      • Summary

    • MVC

      • Choosing Between MVC and Web Forms

      • Creating a Basic MVC Application

        • Creating the Model

        • Creating the Controller

        • Creating the Index View

        • Testing the (Incomplete) Application

        • Completing the Controller and Views

        • Modifying the Site.Master File

      • Extending the Basic MVC Application

        • Configuring Routing

        • Adding Error Handling

        • Adding Authentication

        • Consolidating Data Store Access

        • Adding Support for Foreign Key Constraints

      • Customizing Views

        • Modifying the View

        • Adding View Data

      • Adding to the Model

      • Validating Data

        • Performing Basic Validation

        • Adding Validation Annotations

      • Using Action Results

        • Returning JSON Data

        • Calling Another Controller Method

      • Summary

    • Dynamic Data

      • Creating a Dynamic Data Application

        • Creating the Dynamic Data Site

        • Exploring the Dynamic Data Site

      • Understanding the Anatomy of a Dynamic Data Project

      • Customizing a Dynamic Data Site

        • Customizing with Templates

        • Editing the Default Templates

        • Creating a Custom Page Template

        • Using Entity Templates

        • Customizing Field Templates

        • Customizing with Routes

        • Understanding Routes

        • Switching to Single-Page Editing

        • Using Different Templates for Tables

        • Customizing with Metadata

        • Creating a Metadata Class

        • Changing Display Names

        • Changing Visibility

        • Customizing Field Formatting

        • Using a Custom Field Template

        • Customizing Validation

        • Requiring a Field Value

        • Specifying a Valid Range

        • Customizing Validation Using Extensibility Methods

      • Summary

    • Silverlight

      • Understanding Silverlight

        • Silverlight vs. Flash

        • Silverlight System Requirements

      • Creating a Silverlight Solution

        • Silverlight Compilation

        • The Entry Page

      • Creating a Silverlight Project

        • Designing a Silverlight Page

        • Understanding XAML

        • Setting Properties

        • The XAML Code-Behind

        • Handling Events

        • Browsing the Silverlight Class Libraries

      • Layout

        • The Canvas

        • Layering Elements in a Canvas

        • Dragging Circles

        • The Grid

        • Fine-Tuning Rows and Columns

        • Nesting Layout Containers

        • Spanning Rows and Columns

      • Animation

        • Animation Basics

        • Defining an Animation

        • The Animation Class

        • The Storyboard Class

        • Configuring Animation Properties

        • An Interactive Animation Example

        • Transforms

        • Using a Transform

        • Animating a Transform

      • Using Web Services with Silverlight

        • Creating the Web Service

        • Adding a Web Reference

        • Calling the Web Service

        • Configuring the Web Service URL

        • Cross-Domain Web Service Calls

      • Summary

  • Index

    • ¦ ¦ ¦ ¦ Special Characters

    • ¦ A

    • ¦ B

    • ¦ C

    • ¦ D

    • ¦ E

    • ¦ F

    • ¦ G

    • ¦ H

    • ¦ I

    • ¦ J

    • ¦ L

    • ¦ K

    • ¦ M

    • ¦ N

    • ¦ O

    • ¦ P

    • ¦ Q

    • ¦ R

    • ¦ S

    • ¦ T

    • ¦ U

    • ¦ V

    • ¦ W

    • ¦ X

    • ¦ Y

    • ¦ Z

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan