Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Programming ASP.NET 3.5, Fourth Edition
SPECIAL OFFER: Upgrade this ebook with O’Reilly
A Note Regarding Supplemental Files
Preface
Learning or Programming?
Visual Basic Versus C#
How This Book Is Organized
What You Need to Use This Book
Conventions Used in This Book
Using Code Examples
We'd Like to Hear from You
Safari® Books Online
Acknowledgments
From Jesse Liberty
From Dan Hurwitz
From Dan Maharry
1. Web Development in 2008
AJAX
.NET Framework 3.0 and 3.5
Visual Studio 2008
Internet Information Services 7.0
Beyond 2008
The Silverlight Stack
The Dynamic Languages Stack
The Data Futures Stack
On to VS2008
2. Visual Studio 2008
First Sight: The Start Page
Creating Your First Web Page
Projects and Solutions
Solutions
Projects and Files
Templates
Project names
The Integrated Development Environment
Layout
Building and Running
Menus and Toolbars
File Menu
New
Open
Add
Advanced Save Options
Export Template
Source Control
Edit Menu
Cycle Clipboard Ring (Ctrl-Shift-V)
Finding and replacing
Go To (Ctrl-G)
Insert File As Text
Advanced
Incremental search (Ctrl-I)
Bookmarks
Outlining
IntelliSense
View Menu
Solution Explorer (Ctrl-Alt-L)
Server Explorer (Ctrl-Alt-S)
Properties window (F4)
Visible Aids
Formatting Marks
Object Browser (Ctrl-W, J)
Error List (Ctrl-W, E)
Task List (Ctrl-W, T)
Toolbox (Ctrl-W, X)
Class View (Ctrl-W, C)
Output (Ctrl-W, O)
Other windows
Refactor Menu
Website Menu
Start Options
Copy Web Site
ASP.NET Configuration
Project Menu
Add New Item (Ctrl-Shift-A)
Add Existing Item (Shift-Alt-A)
Add New Solution Folder
Set StartUp Projects
Project Dependencies and Project Build Order
Build Menu
Debug Menu
Data Menu
Format Menu
Tools Menu
Connect to Device
Connect to Database
Code Snippets Manager (Ctrl-K, B)
Choose Toolbox Items
Macros
External Tools
Import and Export Settings
Customize
Options
Window Menu
Help Menu
Dynamic Help (Ctrl-F1, D)
Contents (Ctrl-F1, I), Index (Ctrl-F1, I), and Search (Ctrl-F1, S)
Index Results (Ctrl-F1, T)
Check for Updates
3. Controls: Fundamental Concepts
Events
ASP.NET Events
Event Arguments
Application and Session Events
Page and Control Events
Postback Versus Nonpostback Events
Types of Postback
IsPostBack
Events in Visual Studio 2008
Multiple Controls to One Event Handler
ASP.NET Server Controls
A Simple Demonstration
ASP.NET and Browsers
ASP.NET Server Control Class Hierarchy
CSS Styles
AJAX Server Controls
Extending the Simple Demonstration
AJAX Server Control Class Hierarchy
The ScriptManager Control
HTML Server Controls
Client-Side Processing
4. Basic Controls
Visual Studio Is Not Mandatory
Web Forms: Plain or AJAX?
Label Controls and Literal Controls
TextBox Control
TextBox Behavior
TextBox Extenders
HiddenField Control
Button Controls
Button Behavior
Button Control Extenders
HyperLink Control
Images
Image Control
ImageMap Control
Selecting Values
CheckBox Control
CheckBox behavior
CheckBox extenders
RadioButton Control
Selecting from a List
ListItem Object
CheckBoxList Control
Adding items declaratively
Adding items programmatically from an array or collection
Adding items from a data source
Responding to user selections
RadioButtonList Control
DropDownList Control
DropDownList behavior
DropDownList extenders
ListBox Control
BulletedList Control
BulletedList behavior
BulletedList extenders
Sliders and Ratings
5. More Controls
Panel Controls
The Panel Control and AJAX
Panel Extenders
Collapsible Panels and Accordions
From Columns to Stacks
The UpdatePanel Control
Multiple Update Panels on One Page
Using the UpdateProgress Control
MultiView and View Controls
The Wizard Control
The FileUpload Control
The AdRotator Control
The Advertisement File
Using AdRotator
The Calendar Control
Selecting Dates in the Calendar
Controlling the Calendar's Appearance
Programming the Calendar Control
SelectionChanged event
DayRender event
VisibleMonthChanged event
6. Website Fundamentals
The Page Class
The Code-Behind File
Moving to Another Page
HyperLink
Server.Transfer
Response.Redirect
Cross-Page Posting
Retrieving data from the previous page
How did I get here?
State
Session State
Session state configuration
Session-scoped application objects
View State
State Bag
Application State
Life Cycle
Directives
Application Directive
Assembly Directive
Control Directive
Implements Directive
Import Directive
Master Directive
MasterType Directive
OutputCache Directive
Page Directive
PreviousPageType Directive
Reference Directive
Register Directive
7. Data Source Controls and Connections
Sources of Data and DataSource Controls
Using the ObjectDataSource Control
Using the XmlDataSource Control
Using the SqlDataSource Control
The AdventureWorksLT Database
Using the Server Explorer
Configuring the SqlDataSource
Storing Connection Strings
Passing Parameters to the Select Query
Writing Data to a Database
Multiuser Updates
Tracking the Data Source with Events
8. Using Data-Aware Controls
Hierarchical Data Controls
Tabular Data Controls
Lists of Data
Binding Data to a List
Retrieving the Selected Value from a List
Adding Static Values to a Data-Bound List
One Record at a Time: DetailsView
Paging Through Records
Improving Presentation and Accessibility
Retrieving Values from the Current Record
Adding, Updating, and Deleting Records
Manually Setting the Contents of the Control
Many Records at a Time: GridView
Sorting and Paging
Improving Presentation and Accessibility
Retrieving Values from the Selected Record
Updating and Deleting Records
Templated Controls
DataList Control
Presentation and accessibility
Selecting, updating, and deleting records
FormView Control
Repeater Control
ListView Control
Sorting and paging
Selecting, adding, updating, and deleting data in a ListView
9. ADO.NET
The ADO.NET Object Model
The DataSet Class
The DataTable class
The DataRow class
DbCommand and DbConnection
The DataAdapter Object
The DataReader Object
Getting Started with ADO.NET
Using a DataReader
Creating Data Relationships Within DataSets
Creating Data Objects by Hand
A Simple Database Design
Creating a DataSet by Hand
Creating a DataTable
Adding DataColumns to the DataTable
Adding primary key columns
Adding data to the table
Creating foreign keys and data relationships
Stored Procedures
Creating a Simple Stored Procedure
Creating a Stored Procedure with Parameters
Updating with SQL and ADO.NET
Updating Data with Transactions
The ACID Test
Implementing Transactions
Using database transactions
Using connection transactions
Binding to Business Objects
10. Presenting LINQ
Deconstructing LINQ
LINQ Syntax
The from clause
The join clause
The let clause
The where clause
The orderby and orderbydescending clauses
The select clause
The groupby clause
Other LINQ query operators
Behind the Scenes of a LINQ Query: C# 3.0 at Work
Anonymous types and object initializers
Implicitly typed local variables
Extension methods
Creating your own extension
Lambda expressions
IEnumerable Good, IQueryable Better
LINQ Providers
LINQ to XML
Joining XML to a Different Type of Data
Writing XML with LINQ
LINQ to SQL
From Relations to Objects
Using the Object Relational Designer
Querying DataContext Objects Manually
Joining DataContexts to a Different Type of Data
Writing to the Database with LINQ
Introducing the LinqDataSource Object
11. Validation
The RequiredFieldValidator
The Summary Control
Identifying the User's Errors
The Compare Validator
Checking the Input Type
Comparing to Another Control
Checking Password Strength
Range Checking
Regular Expressions
Custom Validation
Validation Groups
12. Forms-Based Security
Authentication
Anonymous Access
The IUSR account
The IIS 5/6 Directory Security panel
Windows Authentication
Enabling authentication in IIS 7
Basic authentication
Digest authentication
Integrated Windows authentication
Role-based security
Client certificate mapping
Passport Authentication
Forms Authentication
Setting Up Forms-Based Authentication
Creating the Database
Creating and Configuring the Website
Creating Users
Using the Web Site Administration Tool
Using a Create User web page
Creating User-Aware Pages
The Welcome page
The Login page
The Password Recovery page
The Change Password page
Restricting Access to Users
In the code-behind page
In web.config
Enabling Roles
Creating Roles
Using the Web Site Administration Tool
Using a Create Roles web page
Restricting Access to User Roles
In the code-behind page
In web.config
13. Master Pages and Navigation
Master Pages
Adding Content Pages
Using Nested Master Pages
Dynamically Modifying Master Page Contents from Content Pages
Navigation
Customizing Browser History
Getting Started with Site Navigation
Setting Up the Pages
Customizing the Look and Feel
Populating on Demand
Using a Menu for Navigation
Enumerating the Site Map Programmatically
Filtering Based on Security
Creating Access Rules
Creating a Permission-Driven Site Map
Enabling Security Trimming
14. Personalization
Creating Personalized Websites
Configuring the Site for Profiles
Working with Profile Data
Exploring the Profile Tables
Personalizing with Complex Types
Anonymous Personalization
A little more configuration
A little more code
Inheriting Profile Properties
Saving Profile Properties
Themes and Skins
Creating the Test Site
Organizing Site Themes and Skins
Enabling Themes and Skins
Specifying Themes for Your Page
Setting Stylesheet Themes
Setting Customization Themes
Using Named Skins
Web Parts
Web Parts Architecture
Creating Zones
Adding Controls to Zones
Minimizing and Restoring
Enabling Editing and Layout Changes
Creating a user control to enable changing page layout
Moving a part
Adding Parts from a Catalog
15. Custom and User Controls
User Controls
User Controls with Code
The @Control Directive
Properties
Creating a property
Providing an underlying value for the property
Integrating the property into your code
Setting the property from the client
Handling Events
Custom Controls
Properties
The Render Method
Updating the Control
Maintaining State
Maintaining view state
Maintaining control state
Derived Controls
Composite Controls
Modifying the CountedButton Derived Control
Creating the BookCounter Composite Control
INamingContainer
Containing CountedButton2
Creating the BookInquiryList Composite Control
ControlBuilder and ParseChildren attributes
Render method
Rendering the output
Rendering the summary
16. Web Services
Introducing Web Services
Understanding Web Service Protocols and Standards
HTTP
HTTP-GET
HTTP-POST
XML
SOAP
Using SOAP Web Services
Creating a Proxy
Creating a Consumer
Developing an ASP.NET SOAP Web Service
Creating a Web Service
Inline with a text editor
Creating an ASP.NET Web Service with VS2008
The WebService Directive
Deriving from the WebService Class
Calling the Web Service
Developing a WCF Web Service
Creating a WCF Service
Consuming a WCF Service
Using WCF to Call a Public Service
Creating and Consuming AJAX-Enabled Web Services
Introducing REST and JSON
REST
JSON
Consuming a RESTful Web Service
Learning More About Web Services
17. Caching and Performance
Types of Caching
Class Caching
Configuration Caching
Data Caching
Output Caching
Object Caching
Data Caching
DataSourceControl Caching
SQL Cache Dependency
Polling-based cache invalidation
Notification-based cache invalidation
Output Caching
The OutputCache Directive
Duration
VaryByParam
CacheProfile
DiskCacheable
Location
SqlDependency
VaryByControl
VaryByCustom
VaryByHeader
Fragment Caching: Caching Part of a Page
Object Caching
Cache Class Functionality
Dependencies
File change dependency
Cached item dependency
Time dependency
Scavenging
Callback Support
The HttpCachePolicy Class
Performance
ASP.NET-Specific Issues
Session state
View state
Caching
Server controls
Web gardening and web farming
Round trips
General .NET Issues
String concatenation
Minimizing exceptions
Using early binding
Disabling debug mode
Database Issues
Using a DataReader class
Using SQL or Oracle classes rather than OleDB classes
Benchmarking and Profiling
18. Application Logic and Configuration
Introducing IIS 7.0
The Default Website
Virtual Directories
Creating the virtual directory
Virtual directory security and zones
Web Applications
Application Pools and Domains
Application-Wide Logic
The HttpApplication Object
The Global.asax File
Directives
Script blocks
Events
Server-side includes
Object declarations
Global Members
HTTP Handlers and Modules
Configuring the Application
Hierarchical Configuration
Format
Configuration section handler declarations
Configuration sections
Web.config v2.0 and v3.5
Modifying web.config with IIS 7.0
Application Development
.NET Compilation
.NET Globalization
.NET Profile
Application Settings
Connection Strings
Machine Key
Pages and Controls
Providers
Session State
SMTP E-mail
Health and Diagnostics
HTTP Features
Performance
Security
.NET Roles
.NET Trust Levels
.NET Users
Authentication
Authorization rules
IPv4 Address and Domain Restrictions
SSL Settings
Server Components
Web Site Administration Tool
Security
Application
Provider
Custom Configuration Sections
Name/Value Pairs
Objects
19. Tracing, Debugging, and Error Handling
Creating the Sample Application
Tracing
Page-Level Tracing
Inserting into the Trace Log
Application-Level Tracing
Trace Viewer
Debugging
The Debug Toolbar
Breakpoints
Setting a breakpoint
Breakpoints window
Breakpoint properties
Breakpoint icons
Stepping Through Code
Examining Variables and Objects
Debug Windows
Immediate window
Autos window
Locals window
Watch window
Call Stack window
Threads window
Modules window
Disassembly window
Registers window
Memory windows
Debugging ASP.NET Source Code
Error Handling
Custom Error Pages
20. Deployment
Assemblies
Microsoft Intermediate Language (MSIL)
ILDASM
Manifests
Versioning
Private Versus Shared Assemblies
Strong Names
Creating a strong name
Delayed signing
Local Deployment
Full Runtime Compilation
Manual Compilation of Assemblies
Full Precompilation
Precompilation of Code Only
Global Deployment
Windows Installer
Build Configurations
Adding a Setup Project with the Setup Wizard
Adding a Setup Project Manually
Further Customizations
File System editor
Registry editor
File Types editor
User Interface editor
Custom Actions editor
Launch Conditions editor
Deploying the Website
Web Deployment Projects
Compilation
Output Assemblies
Signing
Deployment
21. Epilogue: From Now to vNext
(Some of) The Winnowing Process
On the Stove
Richer Community Experiences
Rich Media Experiences with Silverlight
Rich Data Experiences
An Alternative Web Framework
On the Far Horizon
A. Installing the AJAX Control Toolkit
Downloading the Code
Building the Code and Looking Around
Integrating the Toolkit with VS2008
B. Relational Database Technology: A Crash Course
Tables, Records, and Columns
Table Design
Normalization
Declarative Referential Integrity
SQL
Joining Tables
Using SQL to Manipulate the Database
Further Reference
C. Keyboard Shortcuts
General Actions
Text Generation and Refactoring
Text Navigation
Text Editing and Selection
Main Window Shortcut Keys
Design View Shortcut Keys
Class Diagram Shortcut Keys
SQL Editor Shortcut Keys
Tool Window Shortcut Keys
Find-and-Replace Shortcut Keys
Macro Shortcut Keys
Debugging Shortcut Keys
About the Authors
Colophon
SPECIAL OFFER: Upgrade this ebook with O’Reilly
← Prev
Back
Next →
← Prev
Back
Next →