Evjen ftoc.tex V2 - 01/28/2008 5:00pm Page xxiv
Contents
Tracing from Components 1113
Trace Forwarding 1114
TraceListeners 1114
Diagnostic Switches 1119
Web Events 1121
Debugging 1122
What’s Required 1123
IIS versus ASP.NET Development Server 1124
Starting a Debugging Session 1125
New Tools to Help You with Debugging 1128
Client-side Javascript Debugging 1131
SQL Stored Proc Debugging 1134
Exception and Error Handling 1134
Handling Exceptions on a Page 1135
Handling Application Exceptions 1136
Http Status Codes 1137
Summary 1138
Chapter 25: File I/O and Streams 1139
Working with Drives, Directories, and Files 1140
The DriveInfo Class 1140
The Directory and DirectoryInfo Classes 1143
File and FileInfo 1149
Working with Paths 1154
File and Directory Properties, Attributes, and Access Control Lists 1158
Reading and Writing Files 1166
Streams 1167
Readers and Writers 1171
Compressing Streams 1176
Working with Serial Ports 1181
IIS 5/6 and ASP.NET 1275
IIS 7 and ASP.NET 1276
ASP.NET Request Processing 1277
HttpModules 1278
HttpHandlers 1289
Summary 1295
Chapter 28: Using Business Objects 1297
Using Business Objects in ASP.NET 3.5 1297
Creating Precompiled .NET Business Objects 1298
Using Precompiled Business Objects in Your ASP.NET Applications 1301
COM Interop: Using COM Within .NET 1302
The Runtime Callable Wrapper 1303
Using COM Objects in ASP.NET Code 1304
Error Handling 1309
Deploying COM Components with .NET Applications 1312
Using .NET from Unmanaged Code 1314
The COM-Callable Wrapper 1314
Using .NET Components Within COM Objects 1316
Early versus Late Binding 1320
xxv
Evjen ftoc.tex V2 - 01/28/2008 5:00pm Page xxvi
Contents
Error Handling 1320
Deploying .NET Components with COM Applications 1322
Summary 1324
Chapter 29: Building and Consuming Services 1325
Communication Between Disparate Systems 1325
Building a Simple XML Web Service 1327
The WebService Page Directive 1328
Looking at the Base Web Service Class File 1329
Client-Side Culture Declarations 1387
Translating Values and Behaviors 1389
xxvi
Evjen ftoc.tex V2 - 01/28/2008 5:00pm Page xxvii
Contents
ASP.NET 3.5 Resource Files 1397
Making Use of Local Resources 1397
Making Use of Global Resources 1403
Looking at the Resource Editor 1406
Summary 1407
Chapter 31: Configuration 1409
Configuration Overview 1410
Server Configuration Files 1411
Application Configuration File 1413
How Configuration Settings Are Applied 1414
Detecting Configuration File Changes 1415
Configuration File Format 1415
Common Configuration Settings 1416
Connecting Strings 1416
Configuring Session State 1417
Compilation Configuration 1421
Browser Capabilities 1423
Custom Errors 1426
Authentication 1427
Anonymous Identity 1430
Authorization 1430
Locking-Down Configuration Settings 1433
ASP.NET Page Configuration 1433
Include Files 1435
Configuring ASP.NET Runtime Settings 1436
Chapter 33: Administration and Management 1499
The ASP.NET Web Site Administration Tool 1499
TheHomeTab 1501
The Security Tab 1501
The Application Tab 1510
The Provider Tab 1512
Configuring ASP.NET in IIS on Vista 1514
.NET Compilation 1517
.NET Globalization 1518
.NET Profile 1518
.NET Roles 1520
.NET Trust Levels 1520
.NET Users 1521
Application Settings 1522
Connection Strings 1523
Pages and Controls 1524
Providers 1524
Session State 1524
SMTP E-mail 1526
Summary 1527
Chapter 34: Packaging and Deploying ASP.NET Applications 1529
Deployment Pieces 1530
Steps to Take before Deploying 1530
Methods of Deploying Web Applications 1531
Using XCopy 1531
Using the VS Copy Web Site Option 1534
Deploying a Precompiled Web Application 1537
Building an Installer Program 1539
xxviii
Evjen ftoc.tex V2 - 01/28/2008 5:00pm Page xxix
www.asp.net 1590
Tidying Up Your Code 1591
Refactor! for ASP.NET from Devexpress 1591
Code Style Enforcer 1592
Packer for .NET — Javascript Minimizer 1593
Visual Studio Add-ins 1594
ASPX Edit Helper Add-In for Visual Studio 1595
Power Toys Pack Installer 1596
Extending ASP.NET 1597
ASP.NET AJAX Control Toolkit 1597
xxix
Evjen ftoc.tex V2 - 01/28/2008 5:00pm Page xxx
Contents
Atif Aziz’s ELMAH — Error Logging Modules and Handlers 1598
Helicon’s ISAPI
−
Rewrite 1599
General Purpose Developer Tools 1600
Telerik’s Online Code Converter 1600
WinMerge and Differencing Tools 1601
Reflector 1602
CR
−
Documentor 1603
Process Explorer 1604
Summary 1605
Appendix C: Silverlight 1607
Extending ASP.NET Apps with Silverlight 1607
Step 1: A Basic ASP.NET Application 1609
Finding Vector-Based Content 1610
application development. In the Visual Basic model, developers could drop controls onto a form, set
properties for these controls, and provide code behind them to manipulate the events of the control. For
example, when an end user clicked a button on one of the Visual Basic forms, the code behind the form
handled the event.
Then, in the mid-1990s, the Internet arrived on the scene. Microsoft was unable to move the Visual Basic
model to the development of Internet-based applications. The Internet definitely had a lot of power,
and right away, the problems facing the thick-client application model were revealed. Internet-based
applications created a single instance of the application that everyone could access. Having one instance
of an application meant that when the application was upgraded or patched, the changes made to this
single instance were immediately available to each and every user visiting the application through a
browser.
To participate in the Web application world, Microsoft developed Active Server Pages (ASP). ASP was
a quick and easy way to develop Web pages. ASP pages consisted of a single page that contained a
mix of markup and languages. The power of ASP was that you could include VBScript or JScript code
instructions in the page e xecuted on t he Web server before the page was sent to the end user’s Web
browser. This was an easy way to create dynamic Web pages customized based on instructions dictated
by the developer.
ASP used script between brackets and percentage signs —
<
%%
> — to control server-side behaviors. A
developer could then build an ASP page b y starting with a set of static HTML. Any dynamic element
Evjen flast.tex V2 - 01/28/2008 5:02pm Page xxxii
Introduction
needed by the page was defined using a scripting language (such as VBScript or JScript). When a user
requested the page from the server by using a browser, the
asp.dll
(an ISAPI application that provided
a bridge between the scripting language and the Web server) would take hold of the page and define all
the dynamic aspects of the page on-the-fly based on the programming logic specified in the script. After
surface or form, manipulate the control’s properties, and even work with the code behind these controls
to act on certain events that occur during their lifecycles. What ASP.NET created is really the best of both
models, as you will see throughout this book.
I know you will enjoy working with this latest release of ASP.NET 3.5. Nothing is better than getting
your hands on a new technology and seeing what is possible. The following section discusses the goals
of ASP.NET so you can find out what to expect from this new offering!
The Goals of ASP.NET
ASP.NET 3.5 is another major release of the product and builds upon the core .NET Framework 2.0 with
additional classes and capabilities. This release of the Framework was code-named Orcas internally at
Microsoft. You might hear others referring to this release of ASP.NET as ASP.NET Orcas.ASP.NET3.5
continues on a path to make ASP.NET developers the most productive developers in the Web space.
xxxii
Evjen flast.tex V2 - 01/28/2008 5:02pm Page xxxiii
Introduction
Ever since the release of ASP.NET 2.0, the Microsoft team has had goals focused around developer
productivity, administration, and management, as well as performance and scalability.
Developer Productivity
Much of the focus of ASP.NET 3.5 is on productivity. Huge productivity gains were made with the
release of ASP.NET 1.x; could it be possible to expand further on those gains?
One goal the development team had for ASP.NET was to eliminate much of the tedious coding that
ASP.NET originally required and to make common ASP.NET tasks easier. The developer productivity
capabilities are presented throughout this book. Before venturing into these capabilities, this introduction
will first start by taking a look at the older ASP.NET 1.0 technology in order to make a comparison to
ASP.NET 3.5. Listing I-1 provides an example of using ASP.NET 1.0 to build a table in a Web page that
includes the capability to perform simple paging of the data provided.
Listing I-1: Showing data in a DataGrid server control with paging enabled (VB o nly)
<%@ Page Language="VB" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">