Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Pro ASP.NET 2.0 In CSharp 2005 (2005) [eng]

.pdf
Скачиваний:
107
Добавлен:
16.08.2013
Размер:
29.8 Mб
Скачать

1208 C H A P T E R 3 4 A D VA N C E D W E B S E R V I C E S

To simplify this task, it helps to create a private method like the one shown here. It checks that a token exists and throws an exception if it doesn’t. Otherwise, it returns the user name.

private string GetUsernameToken()

{

//Although there may be many tokens, only one of these

//will be a UsernameToken.

foreach (UsernameToken token in RequestSoapContext.Current.Security.Tokens)

{

return token.Username;

}

throw new SecurityException("Missing security token");

}

You could call the GetUsernameToken() method at the beginning of a web method to ensure that security is in effect. Overall, this is a good approach to enforce security. However, it’s important to keep its limitations in mind. First, it doesn’t support hashing or encrypting the user credentials. Also, it doesn’t support more advanced Windows authentication protocols such as Digest authentication and Integrated Windows authentication. That’s because the authentication is implemented by the WSE extensions, not by IIS. Similarly, the client always needs to submit a password and user name. The client has no way to automatically submit the credentials of the current user, as demonstrated earlier in this chapter with the CredentialCache object. In fact, the Credentials property of the proxy is ignored completely.

Fortunately, you aren’t limited to the scaled-down form of Windows authentication provided by the default WSE authentication service. You can also create your own authentication logic, as described in the next section.

Custom Authentication

By creating your own authentication class, you can perform authentication against any data source, including an XML file or a database. To create your own authenticator, you simply need to create a class that derives from UsernameTokenManager and overrides the AuthenticateToken() method. In this method, your code needs to look up the user who is trying to become authenticated and return the password for that user. ASP.NET will then compare this password against the user credentials and decide whether authentication fails or succeeds.

Creating this class is quite straightforward. Here’s an example that simply returns hard-coded passwords for two users. This provides a quick-and-easy test, although a real-world example would probably use ADO.NET code to get the same information.

public class CustomAuthenticator : UsernameTokenManager

{

protected override string AuthenticateToken(UsernameToken token)

{

string username = token.Username;

if (username == "dan") return "secret";

else if (username == "jenny") return "opensesame";

else

return "";

}

}

C H A P T E R 3 4 A D VA N C E D W E B S E R V I C E S

1209

The reason you don’t perform the password test on your own is because the type of comparison depends on how the credentials are encoded. For example, if they are passed in clear text, you need to perform a simple string comparison. If they are hashed, you need to create a new password hash using the same standardized algorithm, which must take the same data into account (including the random nonce from the client message). However, the WSE can perform this comparison task for you automatically, which dramatically simplifies your logic. The only potential problem is that you need to have the user’s password stored in a retrievable form on the web server. If you’re storing only password hashes in a back-end database, you won’t be able to pass the original password to ASP.NET, and it won’t be able to re-create the credential hash it needs to authenticate the user.

Once you’ve created your authentication class, you still need to tell the WSE to use it for authenticating user tokens by registering your class in the web.config file. To accomplish this, right-click the project name in the Solution Explorer, and select WSE Settings. Next, select the Security tab (shown in Figure 34-11).

Figure 34-11. Security settings

In the Security Tokens Managers section, click the Add button. This displays the SecurityToken Manager dialog box (see Figure 34-12).

1210 C H A P T E R 3 4 A D VA N C E D W E B S E R V I C E S

Figure 34-12. Configuring a new UsernameTokenManager

In the SecurityToken Manager dialog box, you need to specify three pieces of information:

Type: Enter the fully qualified class name, followed by a comma, followed by the assembly name (without the .dll extension). For example, if you have a web project named MyProject with an authentication class named CustomAuthenticator, enter MyProject.CustomAuthenticator, MyProject.

Namespace: Enter the following hard-coded string: http://docs.oasis-open.org/ wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd.

QName: Enter the following hard-code string: UsernameToken.

You build the client in essentially the same way, no matter how your authentication is performed on the server. However, when you create a custom authentication class, you can choose to use hashed passwords, as shown here:

// Create the proxy.

EmployeesServiceWse proxy = new EmployeesServiceWse();

//Add the WS-Security token. proxy.RequestSoapContext.Security.Tokens.Add(

new UsernameToken("dan", "secret", PasswordOption.SendHashed));

//Bind the results.

GridView1.DataSource = proxy.GetEmployees().Tables[0];

GridView1.DataBind();

The best part is that you don’t need to manually hash or encrypt the user password. Instead, the WSE hashes it automatically based on your instructions and performs the hash comparison on the server side. It even incorporates a random nonce value to prevent replay attacks.

Summary

In this chapter, you learned a variety of advanced SOAP techniques, including how to call web services asynchronously, how to enforce security, and how to use SOAP extensions. The world of web services is sure to continue to evolve, so look for new standards and increasingly powerful capabilities to appear in future versions of the .NET Framework.

Index

Special Characters

$ expressions, 298–99 % character, 119, 894

<%# and %> characters, 298 <%@ Register%> directive, 1069 & (ampersand) character, 65, 479

*(asterisk) character, XPath expression, 442, 778

*wildcard operator, 480, 483

@ (at sign) character, XPath expression, 443 | (pipe) character, XPath expression, 443

~ character, 548 ~/ syntax, 568

= (equal) sign, 65

: (colon) character, namespace prefix, xmlns, 430

/ (forward slash) character, XPath expression, 443

. (period) character, XPath expression, 443

?(question mark) character, 761, 778 \ in Path, 482

?wildcard operator, 480, 482–83

A

A p command-line option, 807 A switch, 715

Abandon session state settings, 217 absolute positioning, 32

abstract encryption classes, 846 AccessKey property

of TextBox, 123

Web Form controls, 117 account tokens, 772

AccountOperator value, WindowsBuiltInRole enumeration, 763

ACID properties, 254 AcquireRequestState, 156 ActionList class, 969–70

Active Directory Users and Computers management console, 767

Active Server Pages (ASP), 634–35, 637 ActiveDirectoryMembershipProvider class, 711 ActiveDirectoryMembershipUser class, 711 ActiveStepChanged event, 563 ActiveStepIndex property, 562–63 ActiveViewIndex property, MultiView control,

557

ActiveViewIndexChanged event, MultiView control, 559

ActiveXControls property, HttpBrowserCapabilities, 912

Ad/Advertisement File, 147 adaptive rendering, 899, 914–15 AdCreated, AdRotator event, 147 Add( ) method, 557

AggregateCacheDependency class, 411 database, 292

Add Reference command, Visual Studio, 902 Add Reference dialog box, Visual Studio, 42 Add Web Reference dialog box, 1113

<add> element, 400–401, 418, 810, 831, 833 AddArc( ) method, 1023

AddAt( ) method, 557

AddAttribute method, HtmlTextWriter, 900 AddAttributesToRender method, overriding,

906, 919, 1002 AddBezier method, 1023 AddBeziers method, 1023

AddCacheDependency( ) method, Response class, 419

AddClosedCurve method, 1023 AddCurve method, 1023

AddDays( ) method, DateTime class, 706 AddEllipse method, 1023

AddLine method, 1023 AddLines method, 1023 AddNode( ) method, 582

AddParsedSubObject method, 933, 962 AddPath method, 1023

AddPie method, 1023 AddPolygon method, 1023 AddRectangle method, 1023 AddRectangles method, 1023 AddString method, 1023 AddStyleAttribute method, 900

AddUsersToRole member, Roles class, 794 AddUsersToRoles member, Roles class, 794 AddUserToRole member, Roles class, 794 AddUserToRoles member, Roles class, 794 Administrator value, WindowsBuiltInRole

enumeration, 763 ADO.NET

architecture of, 230–34

data providers, 230–32

 

fundamental classes, 233–34

 

overview, 230

 

SQL Server 2005, 233

 

standardization in ADO.NET, 232

1211

 

1212 I N D E X

changes in .NET 2.0, 229–30 classes, 233–34

Command and DataReader classes, 240–53 calling stored procedures, 251–53 command basics, 240–41

DataReader class, 241–42 ExecuteNonQuery( ) method, 247 ExecuteReader( ) method and

DataReader, 242–46 ExecuteScalar( ) method, 247 overview, 240

SQL injection attacks, 248–50

using parameterized commands, 250–51 Connection class, 234–39

data providers, 230–32 disconnected access model, 276 JOIN queries vs DataRelation, 284 overview, 229

provider-agnostic code

creating objects with factory, 261–62 factory object, 260–61

overview, 260 query with, 262–63

transactions, 253–55 client-initiated, 256–57 isolation levels, 258 nested, 260 savepoints, 259

stored procedure transactions, 255–56 and XML, 464–70

accessing DataSet as XML, 466–68 converting DataSet to XML, 465–66 executing XML query, 468–70 overview, 464–65

AdRotator control, 146–47, 400 advanced breakpoints, 55–56 AdvertisementFile, AdRotator, 147 aggregate dependencies, 410–11

AggregateCacheDependency class, 410–11 AlgorithmName property, 851

<allow> rule, 779, 781

allowAnonymous attribute, profile property, 810

AllowClose property, WebPart class, 1055, 1057, 1069, 1072

AllowConnect property, WebPart class, 1055 AllowEdit property, WebPart class, 1055 AllowHide property, WebPart class, 1055 AllowMinimize property, WebPart class, 1055,

1072

allowOverride, Web.Config location, 164 AllowPaging property, 350, 356, 372, 561, 563 AllowWeekendSelection property, 926 AllowZoneChange property, WebPart class, 1055 AlternateText, AdvertisementFile, 147 alternating item template, 363, 938 AlternatingRowStyle style, 341

ampersand (&) character, 65 anonymous methods, C# 2005, 16 anonymous profiles, 820–22 anonymous users, denying access to, 761

<anonymousIdentification> element, 820 <AnonymousTemplate> template, 793 AnswerLookupError event, 736 antialiasing, 1019–20

<any> element, 1163 AOL property, 912

App_Browsers directory, 155 App_Code directory, 154, 177 App_Data directory, 155 App_GlobalResources directory, 154 App_LocalResources directory, 155 App_Themes directory, 155

App_WebReferences directory, 155, 1111 App.config, 1112

AppearanceEditorPart control, 1070, 1072 <applet> tag, 988

Application collection, 497 application directory structure, 154–55 application domains, 152–53, 624 application event, 156–59

application integration, 426, 428 application lifetime, 153 Application object, 89

application pools, managing in IIS 6.0 application pools and web applications, 644 creating application pools, 641–43

custom application pool identities, 644–47 overview, 641

Application property, 1101 application state, 196–97, 223–24, 494 application update, 154

Application_AuthenticateRequest event, 795 Application_Error method, in global.asax, 158 Application_Start( ) method, 157 ApplicationKey property, 616 application-level traces, 98–99

ApplicationName method, SettingsProvider, 830 ApplicationName property, 720, 889–90 applicationName property, SqlRoleProvider

provider, 790

ApplicationPath method, Request object, 93 ApplicationPath property, HttpRequest class, 90 applications, ASP.NET, 151–68, 177–92. See also

configuration, ASP.NET anatomy of, 152–54

ASP.NET configuration, 159–68 configuration settings, 164–68 machine.config file, 160–62 overview, 159–60

web.config file, 162–64 deploying

ASP.NET side-by-side execution, 650 compilation models, 652–53

I N D E X 1213

configuring HTTP runtime settings,

ASPNET accounts, 672

651–52

ASP.NET coding model. See coding model,

overview, 647–48

ASP.NET

verifying the ASP.NET installation, 648–49

ASP.NET Development Helper, 59–61, 100

with Visual Studio, 653, 655

ASP.NET pages. See pages, ASP.NET

extending HTTP pipeline, 182–92

ASP.NET website, 146

configuring custom HTTP Handler,

aspnet_Applications table, 807

185–86

aspnet_Applications_CreateApplications stored

creating advanced HTTP handler, 187–90

procedure, 808

creating custom HTTP handler, 184–85

aspnet_CheckSchemaVersion stored procedure,

creating custom HTTP module, 190–92

808

HTTP handlers and HTTP modules,

aspnet_compiler.exe tool, 653

183–84

aspnet_isapi.dll file, 622–23, 639, 659

overview, 182

aspnet_Profile table, 807

registering HTTP handlers without

aspnet_Profile_DeleteInactiveProfiles stored

configuring IIS, 186–87

procedure, 809

global.asax application file, 155–59

aspnet_Profile_GetNumberOfInactiveProfiles

application events, 156–58

stored procedure, 809

demonstrating application events, 158–59

aspnet_Profile_GetProfiles stored procedure,

overview, 155–56

808

.NET components, 177–82

aspnet_Profile_GetProperties stored procedure,

overview, 151

808

web application changes in .NET 2.0, 151

aspnet_Profile_SetProperties stored procedure,

applications, web. See web applications

809

application/xhtml+xml content type, 75

aspnet_regiis.exe utility, 639, 649–50

ApplyFormatInEditMode property, 338

aspnet_regsql.exe tool, 807

AppRequestQueueLimit setting, 651

aspnet_regsql.exe utility, 415–17, 714–16, 718,

<appSettings> element, 167–69, 173

1045, 1051

<area> tag, 1013

aspnet_SchemaVersions table, 807

ARGB color values, 120

aspnet_setreg.exe tool, 626, 770

Array class, 369

aspnet_Users table, 807

ArrayList, 825

aspnet_Users_CreateUser stored procedure, 809

Arrays data type, 1098

aspnet_Users_DeleteUser stored procedure, 809

.asax extension, 638

aspnet_wp.exe process, 625–26

ASCII, 490

aspnet_wp.exe utility, 623, 647–48, 664

.ascx extension, 506, 508, 638

<asp:RoleGroup> tag, 793

.ascx file, 36, 508, 518, 522

<asp:TreeNode> tag, 584

.ashx extension, 638

<asp:View> tag, 556

.asmx extension, 152, 186–87, 620, 638

<asp:WizardStep> tag, 560

.asmx file, 36, 1100, 1110

.aspx (web form) files, 506

ASP (Active Server Pages), 634–35, 637

.aspx extension, 152, 400, 506, 508, 584, 620,

asp prefix, 118

638, 648, 692

<asp:CreateUserWizardStep> tag, 743

.ASPXAUTH cookie, 696

aspent_compiler.exe tool, 652

<assemblies> element, 165

<asp:MultiView> tag, 556

assembly cache, global. See GAC

ASP.NET 1.x, migrating projects to

assembly references, 41–43

ASP.NET 2.0, 15

asterisk (*) character, XPath expression, 442, 778

ASP.NET 2.0, 15

asymmetric encryption, 678–79, 845–46

administration, 21

asymmetric key pair, 678

compatibility with ASP.NET 1.0, 15

AsymmetricAlgorithm, 843

data source controls, 17–19

AsyncCompletedEventArgs class, 1183

master pages, 17

asynchronous calls

membership, 19–20

asynchronous services, 1185–86

personalization, 19

concurrent asynchronous calls, 1180–81

rich controls, 20–21

overview, 1175–76

security, 19–20

responsive Windows clients, 1181, 1183–84

Web parts, 21

simple asynchronous call, 1178–79

1214 I N D E X

asynchronous proxy class methods, 1112 asynchronous thread, 11

at sign (@) character, XPath expression, 443 AttributeCount property, XmlTextReader class,

445 attributes

control design time support, 943–44 CSS style, 110–11, 117

design-time attributes, 942–46 attributes and inheritance, 945–46 overview, 942

Properties window, 942–45 Toolbox icon, 946

File and Directory classes, 478–80 Attributes property

DirectoryInfo class, 475 FileInfo class, 475

HTML server controls, 107 Authenticate( ) method, 702 Authenticate event, 684, 724, 731–32 Authenticate property, 732 Authenticate Request event, 683–84 Authenticated property, 732–33

AuthenticateRequest event, HttpApplication class, 191, 684

authentication, 95, 152, 156, 165, 721, 723. See also forms authentication

built-in authentication modules, 684–85 database, 235

indicating success, 90

Internet Information Services (IIS) security, 675–76

overview, 682, 684 process, 670–71 and profiles, 805

<authentication /> section, 695, 704 authentication modules,

WindowsAuthenticationModule class, 685

authentication service, 757 <authentication> element, 165, 684–85, 698 AuthenticationType property, 687 authorization, 152, 165, 670, 672

authorization checks in code overview, 784

using IsInRole( ) method, 784

using PrincipalPermission class, 785–86 file authorization, 783–84

Internet Information Services (IIS) security, 676

overview, 777

protecting non-web-page resources adding file type mapping, 798–99 overview, 798

writing custom HTTP handler, 800–801 rules, 777

URL authorization authorization rules, 778–83 overview, 777

using Roles Service for role-based authorization, 787–93

accessing roles programmatically, 794–95 using LoginView control with roles, 793 with Windows authentication, 796, 798

<authorization> element, 165, 684–85, 698, 761, 778, 780, 1084

AuthorizationStoreRoleProvider class, Roles Service, 791

AuthorizeRequest event, 156, 683–84 AuthorizeUser( ) method, 1194 AutoDetect option, 696, 704 AutoGenerateColumns property, 336–37 AutoGenerateDeleteButton property, 374 AutoGenerateEditButton property, 374 AutoGenerateInsertButton property, 374 AutoGenerateRows property, 372 automatic data binding, 79

automatic event wire-up, 51 automatic postbacks, 67–69

AutomaticallyGenerateDataBindings property, TreeView, 460

automaticSaveEnabled attribute, 816 AutoPostBack property, 68–69, 78, 124, 128, 148 Autos variable watch window, Visual Studio

.NET, 56 AutoSaving event, 817–18 AVERAGE( ) function, 420

.axd extension, 638

B

back reference, regular expressions, 929 BackColor property, 117, 136, 346 BackgroundSounds property, 912 BackupOperator value, WindowsBuiltInRole

enumeration, 763

backward compatibility, COM objects, 92 Base64 string, 69, 71, 206, 863, 885 BaseValidator class, 135–36, 139–40 BEGIN TRANSACTION statement, 255 BeginInvoke( ) method, 1176–77 BeginPageLoad function, 980 BeginRequest, Application event, 156 BeginTransaction( ) method, 256 BehaviorEditorPart control, 1072

Beta property, 912 Bin directory, 14, 154 binary file, 491–92

Binary namespace, 500 Binary option, 813

BinaryFormatter class, 500, 816

BinaryWrite( ) method, HttpResponse class, 92 BinaryWriter class, 491

Bind( ) method, 367, 370 Bindable attribute, 944 BindGrid( ) method, 1072 binding. See data binding <binding> section, 1150

Bitmap class, System.Drawing namespace, 1017 BlankImageUrl property, 590

BodyFileName property, 736 Bold property, FontInfo class, 121 BorderColor property, 117 BorderStyle property, 117, 120 BorderWidth property, 117, 119

BoundField column, 336–37, 340, 373 <BoundField> tag, 337, 826

brackets ( ) character, XPath expression, 443 breadcrumbs, 570–72

breakpoints, 52, 55 Browsable attribute, 943, 945 Browse mode, 1052

Browser property, 90, 912

browsers, and application development adaptive rendering, 914–15

browser detection, 910–11 browser properties, 912–14 HtmlTextWriter class, 909–10 overview, 909

brushes, and dynamic graphics with GDI+, 1026–27

BufferOutput member, HttpResponse class, 91 BufferResponse attribute, 1196 BufferResponse property, 1120, 1126 BuildSiteMap( ) method, 581

BulletedList control, 130, 132, 302 BulletList control, 535

Button control, 118, 533, 558, 738 Button.Click event, 40, 79–80, 81 ButtonField column, 336, 349 ButtonType property, 346 BytesReceived, 239

C

C switch, 715

C# language, 8, 16, 474, 497

cache, global assembly, (GAC). See GAC Cache class, 89, 282

cache dependencies

aggregate dependencies, 410–11

cache notifications in SQL Server 2000 or 7 creating the cache dependency, 418–19 enabling ASP.NET polling, 418 enabling notifications, 415–17

how they work, 417–18 overview, 415

cache notifications in SQL Server 2005 creating the cache dependency, 420 overview, 419–20

I N D E X 1215

custom cache dependencies basic example, 421–22 overview, 420–21

using message queues, 422–24

file and cache item dependencies, 410 item removed callback, 411–13 overview, 409

SQL cache notifications, 413–14 Cache member, HttpResponse class, 91 Cache property, Response class, 398 cache scavenging, 405

cached controls, sharing, 524 CacheDependency class, 392, 410–11, 414,

421–22

CacheDuration property, 407, 1120–23 CacheExpirationPolicy property, 407 CacheItemRemovedReason enumeration, 413 CacheKeyDependency property, 407 CachePriority enumeration, 406 CacheProfile attribute, 401 cacheRolesInCookie option, <roleManager>

configuration tag, 789

caching, 806. See also cache dependencies changes in .NET 2.0, 391–92

data caching

adding items to the cache, 402–4 cache priorities, 405–6

with data source controls, 406–9 overview, 392, 401–2

simple cache test, 404–5 disabling caching while testing, 394 output caching

cache profiles, 400–401 caching to disk, 401

custom caching control, 396–97 declarative output caching, 393–94 fragment caching, 398

with HttpCachePolicy class, 397–98 overview, 392–93

post-cache substitution, 398–400 and the query string, 394–95

with specific query string parameters, 395 overview, 391–92

reusability of cached page, 394

Calendar control, 32, 146, 148–50, 1049, 1057 Cancel property, 515, 736

CancelAsync( ) method, 1184–85 CancelButtonClick event, 563 CancelButtonStyle style, 565 CancelDestinationPageUrl property, 563 CanConvertFrom method, 952–53 CanConvertTo method, 952–53

Cascading Style Sheets (CSS), 107, 525–28, 533, 535, 546, 725–26

CaseSensitive property, DataTable control, 351 Catalog mode, 1052

1216 I N D E X

CatalogIconImageUrl property, WebPart class, 1055

CatalogImageUrl member, IWebPart Interface, 1058

CatalogZone control, 1045, 1048, 1050–51, 1053, 1083

Category attribute, 943

CausesValidation property, 134–37, 143–44 CellPadding property, 129

Cells collection, GridViewRow class, 344 CellSpacing property, 129

Central Processing Unit (CPU), 627

CGI (Common Gateway Interface), 4–5, 635 ChainStream( ) method, 1197, 1200 change event, 78

change notification, 230 changed-value updating, 273 ChangePassword( ) method, 885, 887 ChangePassword control, 724, 739–40 charting, with GDI, 1037–42 CheckBox control, 118, 829 CheckBoxField column, 336 CheckBoxList control, 127–30, 302, 528 CheckBoxStyle style, 726

Checked property, TreeNode control, 590 child controls, 82, 106, 113

ChildNodes collection SiteMapNode class, 582 XmlDocument, 435, 438

ChildNodes property, 576 ChildNodesPadding property, 589

Choose Location dialog box, Visual Studio, 27 ChromeState property, WebPart class, 1056 ChromeStyle property, WebPart class, 1072 ChromeType property, WebPart class, 1055 cHTML (compact HTML), 909 ChtmlTextWriter class, 909

Class View, Visual Studio, 35 ClassKey property, 614

Click event, Web Form controls, 124 Client After Authentication privilege, 767 client callbacks, 899

creating

building basic page, 992 how they work, 995–96

implementing callback, 993–94 overview, 991

writing client-side script, 994–95 client server development, 3–4

ClientCertificate property, HttpRequest class, 90 ClientID property, 106

client-initiated transactions, 254, 256–58 ClientScript property, Page, 986 ClientScriptManager object, 986 client-side JavaScript, 68, 132, 141 ClientValidationFunction, 141

Close method Connection, 236–37 DataReader, 242 File class, 489

CloseFigure( ) method, 1023

CLR (common language runtime), 5, 9, 11–12, 152, 154, 237, 599, 607–10, 618, 623–24, 626–27, 651, 843, 942

ClrVersion property, 912

CLS (common language specification), 10–11 CMS (Cryptographic Message Syntax), 840 CN (Common Name, server certificate), 682 code. See also code serialization; inline code

model, for coding web pages adding to user controls

adding events, 514–17 adding properties, 510–11

exposing inner web control, 517–18 handling events, 508–10

overview, 508

using custom objects, 512–14 data retrieval and processing, 232

Code Document Object Model (CodeDOM), 299 Code Editor, Visual Studio

adding assembly references, 41–43 error underlining, 46

member list, 44 outlining, 44

code serialization, 949–65 overview, 949

serialization attributes, 957–65 controls with collections, 958–62 overview, 957–58

templated controls, 958 type converters

attaching a type converter, 954–55 control with object properties, 950–51 creating a custom type converter, 952–54 ExpandableObjectConverter, 955, 957 overview, 949

type editors, 962–65 code-behind model, 47, 153

CodeDOM (Code Document Object Model), 299 CodeExpression object, 300

CodeFile attribute, 49 coding model, ASP.NET

how code-behind files are connected to pages, 49

how control tags are connected to page variables, 50

how events are connected to event handlers, 50–51

overview, 47–49 ColdFusion, 4

CollapseImageUrl property, 590 CollectionConverter, 959

I N D E X 1217

colon ( : ) character, namespace prefix, xmlns,

CompilationTempDirectory setting, 652

430

compilers, .NET, 24–25

Color data type, 965

Component class, 326

Color property, 32, 120

Component Object Model (COM), 6, 1089–91

Colors class, 120

Component property, 967

ColorTranslator class, 120

component-based technology, 1088–89

columns, defining, GridView control, 336–39

components, 153, 178–79, 182

Columns collection, 279, 292–93

composite controls, 899, 923–25

Columns property, 339

CompositeControl class, 924

<Columns> section, 336

compression, 498–99

ColumnSpan property, 376

concurrency strategies, 273–74

COM (Component Object Model), 6, 1089–91

concurrent asynchronous calls, 1180–81

COM objects, backward compatibility, 92

.config files, 183

COM+ transactions, 254, 1126

configuration, ASP.NET, 159–68

Combine, Path method, 482–83

encrypting configuration sections, 175

Command and DataReader classes, 240–53

command-line encryption, 176–77

command basics, 240–41

programmatic encryption, 176

DataReader class, 241–42

extending configuration file structure, 173–75

ExecuteNonQuery( ) method, 247

machine.config file, 160–62

ExecuteReader( ) method and DataReader,

overview, 159–60

242–46

reading and writing configuration sections

CommandBehavior, 244

programmatically, 168–71

overview, 243

settings, 164–68

processing multiple result sets, 244–46

<appSettings> element, 167–68

ExecuteScalar( ) method, 247

<configuration> element, 165

overview, 240

<connectionStrings> element, 167

SQL injection attacks, 248–50

<customErrors> element, 166

using parameterized commands, 250–51

<system.web> element, 166

Command classes, ADO.NET

overview, 164–65

(OleDbCommand, SqlCommand), 241

web.config file, 162–64

Command object, 230, 240–41, 280–81

overview, 162–63

CommandArgument property, 366

using <location> elements, 163–64

CommandBehavior, 244

Website Administration Tool (WAT), 171, 173

CommandField column, 336, 346, 349, 367, 370

<configuration /> element, 718

command-line encryption, 176–77

configuration element, web.config file, 165

CommandName property, 366, 370–71, 730,

configuration files. See also web.config file

738–40

applying master pages through, 549

commands, types of, 240

applying themes through, 536

CommandType enumeration, 240

configuration inheritance, 162–63

Commit( ) method, 256

configuration settings, 152

Common Gateway Interface (CGI), 4–5, 635

<configuration> element, 165, 781

common language runtime (CLR), 5, 9, 11–12,

ConfigurationSettings class, 167–68

152, 154, 237, 599, 607–10, 618, 623–24,

configured (web.config) impersonation, 765

626–27, 651, 843, 942

ConflictDetection property, SqlDataSource

common language specification (CLS), 10–11

class, 321, 330, 386

Common Name, server certificate (CN), 682

Connect mode, 1052, 1081

Common Object Request Broker Architecture

ConnectErrorMessage property, WebPart class,

(CORBA), 1089–91

1056

compact HTML (cHTML), 909

Connection class, 234–39

CompareAllValues property, 330

connection pooling, 237–39

CompareValidator control, 133, 137–38

connection statistics, 239

compilation, 8–9, 166

connection strings, 235

of component source codes, 178

overview, 234

of custom HTTP handlers, 185–86

testing connection, 236–37

compilation tag, web.config file, 165–66

Connection Lifetime settings, connection

<compilation> element, 165, 648

pooling, 238