Pro ASP NET 2.0 in c# 2005

1.5K 408 0
Pro ASP NET 2.0 in c# 2005

Đ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

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 owner and the publisher. ISBN-13: 978-1-59059-768-2 ISBN-10: 1-59059-768-0 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Lead Editor: Ewan Buckingham Technical Reviewers: Robert Lair, Jason Lefebvre Editorial Board: Steve Anglin, Ewan Buckingham, Gary Cornell, Jason Gilmore, Jonathan Gennick, Jonathan Hassell, James Huddleston, Chris Mills, Matthew Moodie, Dominic Shakeshaft, Jim Sumser, Keir Thomas, Matt Wade Project Manager: Julie M. Smith Copy Edit Manager: Nicole LeClerc Copy Editor: Kim Wimpsett Assistant Production Director: Kari Brooks-Copony Production Editor: Kelly Winquist Compositor: Dina Quan Proofreader: Lori Bring Indexer: Broccoli Information Management Artist: Kinetic Publishing Services, LLC Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 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 http://www.springeronline.com. For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA 94710. Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit http://www.apress.com. 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 http://www.apress.com in the Source Code/ Download section.

CYAN MAGENTA YELLOW BLACK PANTONE 123 CV BOOKS FOR PROFESSIONALS BY PROFESSIONALS ® Pro ASP.NET 2.0 in C# 2005 Pro SPECIAL EDITION ASP.NET 2.0 Free Companion eBook • A carefully selected library of chapters from 18 other Apress Pro and Expert titles designed to complement this book and broaden your knowledge of ASP NET 2.0, C# 2005, VB 2005, and SQL Server 2005 That’s more than 2,000 information-rich pages in eBook form, all fully supported with code samples on apress.com • An eBook copy of ASPToday.com on ASP NET 2.0 containing 33 articles and 638 pages covering ASP.NET 2.0 and SQL Server 2005 from Apress’s ASPToday website ASPToday specializes in publishing quality articles for ASP developers This is the first time this material is being made available in eBook form • A full selection of our NET 2.0 road maps that illustrate how Apress books can be linked together by you, the reader, to create your own custom-made learning curve to help you master the technology areas you need to know C# 2005 Mario Szpuszta, coauthor of Advanced NET Remoting (Apress) Welcome to Pro ASP NET 2.0 in C# 2005, Special Edition In this book, you’ll learn how ASP.NET 2.0 really works You won’t be bored with a rehash of the C# language—instead, you’ll get the hard-won practical advice that you need to build sophisticated, scalable websites New features are clearly identified, so if you’ve programmed with a previous version of ASP NET, you’ll sail through the basics and get right to the most important changes and enhancements You’ll also dig into advanced topics that other ASP.NET books leave out, such as custom control creation, image handling, and encryption You’ll spend two complete chapters learning to make highly responsive pages with Ajax techniques and exploring Microsoft’s next-generation Atlas platform There’s no better way to prepare for the future of the Web For this special edition of the book, we’ve also included a bonus CD containing a host of valuable extras to help you really master the technology: in Dear Reader, Matthew MacDonald, author of Pro ASP.NET 1.1 in C# (Apress) Beginning ASP.NET 2.0 in C# 2005: From Novice to Professional (Apress) Microsoft NET Distributed Applications Programming NET Web Services ASP.NET: The Complete Reference Free eBook Welcome aboard! For a limited time only Matthew MacDonald (Microsoft MVP, MCSD) RELATED TITLES SPECIAL EDITION FULLY UPDATED AND EXPANDED WITH TWO NEW CHAPTERS: “JavaScript and Ajax” and “Atlas” THE EXPERT’S VOICE ® IN NET Bonus CD includes a free ASPToday.com eBook— over 600 pages—valued at $25! Pro ASP.NET 2.0 in C# 2005 Create next-generation web applications with the latest version of Microsoft’s revolutionary technology See last page for details SPECIAL EDITION www.asptoday.com BONUS CD SOURCE CODE ONLINE INCLUDED Matthew MacDonald and Mario Szpuszta ISBN 1-59059-768-0 www.apress.com 56499 MacDonald, Szpuszta US $64.99 Shelve in Microsoft/.NET User level: Intermediate–Advanced 89253 59768 781590 597682 this print for content only—size & color not accurate Bonus CD contains an additional 2,000 pages of high-quality content from 18 Apress ASP.NET 2.0, C# 2005, VB 2005, SQL Server 2005, and Visual Studio 2005 titles 7" x 9-1/4" / CASEBOUND / MALLOY 7680FM.qxd 8/25/06 12:34 PM Page i Pro ASP.NET 2.0 in C# 2005 Special Edition Matthew MacDonald and Mario Szpuszta 7680FM.qxd 8/25/06 12:34 PM Page ii Pro ASP.NET 2.0 in C# 2005, Special Edition Copyright © 2006 by Matthew MacDonald 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 owner and the publisher ISBN-13: 978-1-59059-768-2 ISBN-10: 1-59059-768-0 Printed and bound in the United States of America Trademarked names may appear in this book Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark Lead Editor: Ewan Buckingham Technical Reviewers: Robert Lair, Jason Lefebvre Editorial Board: Steve Anglin, Ewan Buckingham, Gary Cornell, Jason Gilmore, Jonathan Gennick, Jonathan Hassell, James Huddleston, Chris Mills, Matthew Moodie, Dominic Shakeshaft, Jim Sumser, Keir Thomas, Matt Wade Project Manager: Julie M Smith Copy Edit Manager: Nicole LeClerc Copy Editor: Kim Wimpsett Assistant Production Director: Kari Brooks-Copony Production Editor: Kelly Winquist Compositor: Dina Quan Proofreader: Lori Bring Indexer: Broccoli Information Management Artist: Kinetic Publishing Services, LLC Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 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 http://www.springeronline.com For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA 94710 Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit http://www.apress.com 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 http://www.apress.com in the Source Code/ Download section 7680FM.qxd 8/25/06 12:34 PM Page iii 7680FM.qxd 8/25/06 12:34 PM Page iv Contents at a Glance About the Authors xxviii About the Technical Reviewers xxix Introduction xxx PART ■■■ Core Concepts ■ CHAPTER Introducing ASP.NET ■ CHAPTER Visual Studio 2005 25 ■ CHAPTER Web Forms 73 ■ CHAPTER Server Controls 115 ■ CHAPTER ASP.NET Applications 163 ■ CHAPTER State Management 211 PART ■■■ Data Access ■ CHAPTER ADO.NET Fundamentals 247 ■ CHAPTER Data Components and the DataSet 285 ■ CHAPTER Data Binding 325 ■ CHAPTER 10 Rich Data Controls 365 ■ CHAPTER 11 Caching and Asynchronous Pages 425 ■ CHAPTER 12 XML 471 ■ CHAPTER 13 Files and Streams 517 PART ■■■ Building ASP.NET Websites ■ CHAPTER 14 ■ CHAPTER 15 Themes and Master Pages 571 ■ CHAPTER 16 Website Navigation 601 ■ CHAPTER 17 Resources and Localization 651 ■ CHAPTER 18 iv User Controls 551 Website Deployment 689 7680FM.qxd 8/25/06 12:34 PM PART ■■■ Page v Security ■ CHAPTER 19 The ASP.NET Security Model 757 ■ CHAPTER 20 Forms Authentication 779 ■ CHAPTER 21 Membership 799 ■ CHAPTER 22 Windows Authentication 843 ■ CHAPTER 23 Authorization and Roles 871 ■ CHAPTER 24 Profiles 897 ■ CHAPTER 25 Cryptography 933 ■ CHAPTER 26 Custom Membership Providers 961 PART ■■■ Advanced User Interface ■ CHAPTER 27 Custom Server Controls 993 ■ CHAPTER 28 Design-Time Support 1037 ■ CHAPTER 29 Dynamic Graphics and GDI+ 1071 ■ CHAPTER 30 Portals with Web Part Pages 1103 PART ■■■ Web Services ■ CHAPTER 31 Creating Web Services 1159 ■ CHAPTER 32 Web Service Standards and Extensions 1201 ■ CHAPTER 33 Advanced Web Services 1247 PART ■■■ Client-Side Programming ■ CHAPTER 34 JavaScript and Ajax 1285 ■ CHAPTER 35 Atlas 1333 ■ INDEX 1379 v 7680FM.qxd 8/25/06 12:34 PM Page vi Contents About the Authors xxviii About the Technical Reviewers xxix Introduction xxx PART ■ CHAPTER ■■■ Core Concepts Introducing ASP.NET The Evolution of Web Development The Early Web Development World What’s Wrong with Classic ASP? ASP.NET 1.0 Seven Important Facts About ASP.NET Fact 1: ASP.NET Is Integrated with the NET Framework Fact 2: ASP.NET Is Compiled, Not Interpreted Fact 3: ASP.NET Is Multilanguage Fact 4: ASP.NET Is Hosted by the Common Language Runtime 11 Fact 5: ASP.NET Is Object-Oriented 13 Fact 6: ASP.NET Is Multidevice and Multibrowser 14 Fact 7: ASP.NET Is Easy to Deploy and Configure 15 ASP.NET 2.0: The Story Continues 15 C# 2005 16 Visual Studio 2005 16 ASP.NET 2.0 17 Ajax and Atlas 22 Summary 24 ■ CHAPTER Visual Studio 2005 25 The NET Development Model 26 The Compiler 26 The Visual Studio IDE 27 Websites in Visual Studio 28 Projectless Development 30 Migrating a Visual Studio NET Project 31 Designing a Web Page 33 vi 7680FM.qxd 8/25/06 12:34 PM Page vii ■CONTENTS The Visual Studio IDE 39 Solution Explorer 40 Document Window 41 Toolbox 42 Error List and Task List 42 Server Explorer 44 The Code Editor 45 Adding Assembly References 46 IntelliSense and Outlining 49 The Code Model 52 How Code-Behind Files Are Connected to Pages 54 How Control Tags Are Connected to Page Variables 55 How Events Are Connected to Event Handlers 57 Visual Studio Debugging 58 Single-Step Debugging 59 Variable Watches 62 Advanced Breakpoints 63 Visual Studio Macros 64 Visual Studio 2005 Web Application Projects 66 Migrating Existing Projects 68 New Configuration Settings 68 ASP.NET Development Helper 70 Summary 71 ■ CHAPTER Web Forms 73 Page Processing 74 HTML Forms 74 Dynamic User Interface 76 The ASP.NET Event Model 76 Automatic Postbacks 77 View State 79 XHTML Compliance 83 Web Forms Processing Stages 87 Page Framework Initialization 88 User Code Initialization 88 Validation 89 Event Handling 89 Automatic Data Binding 89 Cleanup 90 A Page Flow Example 90 vii 7680FM.qxd viii 8/25/06 12:34 PM Page viii ■CONTENTS The Page As a Control Container 93 Showing the Control Tree 93 The Page Header 97 Dynamic Control Creation 98 The Page Class 100 Session, Application, and Cache 100 Request 101 Response 102 Server 104 User 107 Trace 107 Accessing the HTTP Context in Another Class 113 Summary 114 ■ CHAPTER Server Controls 115 Types of Server Controls 116 The Server Control Hierarchy 117 HTML Server Controls 118 The HtmlControl Class 119 The HtmlContainerControl Class 120 The HtmlInputControl Class 120 The HTML Server Control Classes 120 Setting Style Attributes and Other Properties 122 Programmatically Creating Server Controls 123 Handling Server-Side Events 125 Web Controls 128 The WebControl Base Class 129 Basic Web Control Classes 129 Units 131 Enumerated Values 132 Colors 132 Fonts 133 Focus 134 The Default Button 135 Scrollable Panels 136 Handling Web Control Events 137 The List Controls 139 The Selectable List Controls 141 The BulletedList Control 142 Input Validation Controls 144 The Validation Controls 145 The Validation Process 146 The BaseValidator Class 147 7680FM.qxd 8/25/06 12:34 PM Page ix ■CONTENTS The RequiredFieldValidator Control 149 The RangeValidator Control 149 The CompareValidator Control 149 The RegularExpressionValidator Control 150 The CustomValidator Control 153 The ValidationSummary Control 154 Using the Validators Programmatically 155 Validation Groups 156 The ASP.NET Rich Controls 157 The AdRotator Control 158 The Calendar Control 160 Summary 162 ■ CHAPTER ASP.NET Applications 163 Anatomy of an ASP.NET Application 164 The Application Domain 164 Application Lifetime 165 Application Updates 166 Application Directory Structure 166 The Global.asax Application File 167 Application Events 168 Demonstrating Application Events 170 ASP.NET Configuration 171 The Machine.config File 172 The Web.config File 174 Configuration Settings 177 Reading and Writing Configuration Sections Programmatically 181 The Website Administration Tool (WAT) 184 Extending the Configuration File Structure 185 Encrypting Configuration Sections 189 NET Components 191 Creating a Component 191 Using a Component Through the App_Code Directory 193 Using a Component Through the Bin Directory 194 Extending the HTTP Pipeline 196 HTTP Handlers and HTTP Modules 196 Creating a Custom HTTP Handler 198 Configuring a Custom HTTP Handler 199 Registering HTTP Handlers Without Configuring IIS 200 Creating an Advanced HTTP Handler 201 Creating an HTTP Handler for Non-HTML Content 203 Creating a Custom HTTP Module 206 Summary 209 ix 7680Index.qxd 1412 8/28/06 11:07 AM Page 1412 ■INDEX Secure Sockets Layers (SSL), 758–783, 786, 791, 934–936 certificates, 767–768 encoding information with, 771–772 installing certificates in IIS, 769–771 overview, 767 securing session state, 239–240 security See also encrypting data; Secure Sockets Layers; security controls and ASP NET 2.0, 20 ASP.NET security processes, 761–764 authentication, 760–761 authorization, 762 encryption, 763 impersonation, 761 authentication, 772, 774–775 built-in authentication modules, 774–775 overview, 772, 774 authorization, 775–777 overview, 775–776 security context, 776–777 ClientCertificate property, 101 creating secure software gatekeepers, 759 overview, 757 secure coding guidelines, 758–759 understanding potential threats, 758 directory permissions, 520 Internet Information Services (IIS) security See also Secure Sockets Layers (SSL) authentication, 765–766 authorization, 766 overview, 765 of keys, 173–174 Membership API, 777 overview, 757 Profiles API, 778 for query strings, 223 Roles API, 778 settings, IIS, 15 state management options, 212 of view state, 82 web services authenticating users, 1263 authorizing users, 1264 testing the SOAP authentication system, 1264–1266 security controls ChangePassword control, 830–831 CreateUserWizard control, 831, 833–835 Login control overview, 814–817 programming, 821, 823 and templates, 819–821 LoginStatus control, 823–824 LoginView control, 824–825 PasswordRecovery control overview, 825–826, 828 templates, 828–830 Security Identifier (SID), 761 security trimming, 633–634 SecurityException, 520 SecurityIdentifier class, 857 Seek( ) method, 538, 942 Select, DataTable, 306 Select, XPathNavigator, 490 Select( ) method, 363, 411, 630 Select class, Atlas Client, 1349 SELECT parameters, 443 SELECT statement, 443, 454 select tag, 332 selectable list controls, 141–143 Selectable property, 644 SelectAction property, TreeNode control, 641 SelectCommand property, 301, 342 SelectCountMethod property, 388–389 SelectedDataKeys property, 378 SelectedDate property, Calendar control, 1114 SelectedDateChanged event, Calendar class, 1114 SelectedIndex property, 140, 378, 380, 400 SelectedIndexChanged event, 140, 378, 379, 380, 838, 920 SelectedItem property, 142, 561 SelectedItem property, list controls, 140 selectedItemCssClass property, 1364 SelectedItemStyle property, 531 SelectedNodeChanged event, 635, 636–637 SelectedNodeStyle property, 641 SelectedRowStyle property, 378 SelectedRowStyle style, 371 SelectedValue property, 401, 837 SelectImageUrl property, 377 SelectIndexChanged event, 398 Selecting event, 357, 363 Selecting event, SqlDataSource control, 422 selectionChanged event, 160, 1351 SelectionMode property, 160 SelectMethod property, 354 SelectMethod query, 443 SelectRows, 258 SelectText property, 377 send( ) method, 1316 SendingEmail event, 827, 834 SendMailError event, 827, 834 separatorCssClass property, 1364 SeparatorImageUrl property, 644 element, ListView, 1361 Serializable attribute, 545–546 serializable object, 545–546 Serializable value, IsolationLevel enumeration, 278 serialization See code serialization serializeAs attribute, profile property, 904 server control tags, 1347 server controls, 13–14, 120–126 See also custom server controls Atlas, 1338–1339 Atlas Control Toolkit, 1376–1377 7680Index.qxd 8/28/06 11:07 AM Page 1413 ■INDEX Set Next Statement command, 62 SetAttributes( ) method, File class, 519 SetAuthCookie( ) method, FormsAuthentication class, 795 SetCacheability( ) method, 431 SetCurrentDirectory( ) method, Directory class, 519 SetData( ) method, 1359, 1364 SetExpires( ) method, 431 element, 1351 SetPropertyAction, Atlas, 1351–1352 SetPropertyValue( ) method, 905 SetPropertyValues( ) method, 924, 929 Setting Style Attributes, 122–123 settings, locked, 175 SettingsContext object, 927 SettingsPropertyCollection object, 927 SettingsPropertyValueCollection object, 927 SettingsProvider abstract class, 923 SetValue( ) method, PropertyDescriptor class, 1065 SHA1 algorithm, 793 shadow copies, 166 shared locks, 278 Shared property, of OutputCache directive, 570 SharePoint Services, 891 shopping carts, building multiple selection, 922–923 overview, 916 shopping cart classes, 917–919 test page, 920–922 ShoppingCartItem class, 917, 921 Short Date data type, 371 Show Friendly Http Errors option, 727 Show Next Statement command, 62 ShowCheckBox property, TreeNode control, 641 ShowCheckBoxes property, TreeView control, 641 ShowDirectoryContents, 531 ShowEditButton property, 398 ShowExpandCollapse property, TreeView control, 640 ShowFooter property, GridView control, 408 ShowHeader property, 530 ShowMessageBox property, ValidationSummary control, 154 ShowSelect property, 377 ShowStartingNode control, 620 ShowStartingNode property, SiteMapDataSource control, 619 ShowSummary property, ValidationSummary control, 154 ShowToolTips property, 618 shut down application domains, 165 shutdownTimeout configuration, 694 SideBarButtonClick event, 609 SideBarButtonStyle style, 611 SideBarStyle style, 611 SideBarTemplate style, 612 Find it faster at http://superindex.apress.com/ control extenders, 1373–1376 overview, 1368 partial rendering and UpdatePanel, 1368–1371 showing indicator during time-consuming updates, 1372–1373 timed refreshes, 1371–1372 changes in NET 2.0, 115 hierarchy of, 117–118 overview, 117 types of, 116–117 Server Explorer, 39, 44–45 server memory, 425 Server object, 104–107 server parameter, Wsdl.exe, 1180 Server property, 1173 Server Variables, Trace Log, 108 ServerChange event, 125 ServerClick event, 125, 126–127, 138–139 Server.MapPath, 894 ServerRoundtrips, 258 servers, database, 253 Servers group, Web tab of Properties window, 69 Server-Side events, 125, 126–127, 137–138 server-side execution, 74 server-side form tag, 131 server-side input validation, 144, 153 Server.Transfer, 102, 105 ServerUtility class, 104 ServerVariables property, HttpRequest class, 101 Service Broker, 454 serviceProvider parameter, 680 element, 1343, 1345 Session collection, 1097, 1195, 1197 Session object, 100, 303 Session property, 1173 session state, 231–239, 438, 774, 1195–1196 configuring, 234–239 cookieless, 238 mode session state setting, 234–237 overview, 234 timeout, 239 data types, 212–213 lifetime, 212–213 overview, 231 performance, 212–213 scope, 212–213 securing, 239–240 security, 212–213 session architecture, 231–232 state management options, 212–213 storage location, 212–213 using, 232–234 session state management, 212–213, 231 Session State, Trace Log, 108 SessionID, 107–108, 231, 234, 238 sessionState element, 177 sesstion state, and HTTP handlers, 206 1413 7680Index.qxd 1414 8/28/06 11:07 AM Page 1414 ■INDEX SignOut( ) method, 792, 795, 823 simple asynchronous call, 1250–1251 Simple Mail Transfer Protocol (SMTP), 751–752, 810 Simple Object Access Protocol (SOAP), 698, 1201–1202, 1222–1223 SimpleRepeaterItem container, 1030 SimpleRepeaterItem control, 1030 SimpleRole class, 963 SimpleSqlResourceDatabaseHelper class, 674, 676, 685 SimpleSqlResourceDesignerProvider class, 682 SimpleSqlResourceProvider class, 675, 678, 682 SimpleSqlResourceProviderFactory class, 678 SimpleUser class, 963 single value binding, 326–328 SingleBitPerPixelGridFit, 1080 single-step debugging, 59–62 site maps adding custom site map information, 625 binding other controls, 623–624 binding portions of, 619–622 binding to, 616–617 breadcrumbs, 617–619 creating custom SiteMapProvider adding caching, 631–632 adding sorting, 631 creating site map provider, 627–630 overview, 626 storing site map information in a database, 626–627 defining, 614–615 overview, 613–614 security trimming, 633–634 site map objects, 622–623 URL mapping, 632–633 site precompilation model, 723 SiteMap class, 622, 626 SiteMap control, 614 element, 614–615, 627 SiteMapDataSource control, 339, 441, 613–616, 621–622, 624 siteMapFile attribute, 621 SiteMapNode class, 622, 625, 628–629, 647 element, 614–615 SiteMapPath control, 617–620, 624 SiteMapProvider, custom adding caching, 631–632 adding sorting, 631 creating site map provider, 627–630 overview, 626 storing site map information in a database, 626–627 SiteMapProvider class, 615, 626–627 SiteMapProvider control, 623, 625 Size property, FontInfo class, 133 SkinID property, TreeView control, 642 skins multiple, creating for same control, 578–579 with templates and images, 579–581 sliding expiration, 437 slidingExpiration parameter, 437, 786 smart devices, 14 smart tags, 35, 1037 ActionList class, 1065–1066 ControlDesigner, 1068–1069 DesignerActionItem collection, 1067–1068 overview, 1064 SmoothingQuality property, 1080 SOAP 1167–1168, 1203–1216, 1224–1231, 1342 , custom serialization for large data types client side, 1239–1242 overview, 1237 server side, 1237–1239 customizing XML serialization with IXmlSerializable, 1234 overview, 1233–1235 schemas for custom data types, 1235–1236 encoding complex data types, 1224–1228 creating custom class, 1225–1226 generating proxy, 1226–1227 overview, 1224–1225 extensions creating, 1268–1275 overview, 1266–1268 overview, 1203 schema importer extensions, 1242–1244 shaping XML of complex data types, 1228–1231 SOAP encoding, 1204–1205 SOAP envelope, 1208–1212 fault messages, 1210–1212 overview, 1208–1209 request messages, 1209 response messages, 1210 SOAP header, 1212–1216 consuming web service that uses custom header, 1215–1216 custom header, 1213–1214 linking header to web service, 1213–1215 overview, 1212–1213 testing, 1264–1266 toolkit, 1191–1192 tracing SOAP messages, 1206–1208 type sharing, 1231–1233 versions, 1205 soap extension, 708 Soap namespace, 546 SOAP XML format, 546 SoapClient object, 1191 SoapDocument attribute, 1231 SoapExtension attribute, 1268–1269 SoapExtension class, 1269–1273 SoapFormatter class, 546 SoapHttpClientProcotol.Invoke method, 1184 SoapHttpClientProtocol, 1184 7680Index.qxd 8/28/06 11:07 AM Page 1415 ■INDEX sorting with, 381–382 updating records and KeyFields, 350 overview, 348–350 with stored procedures, 351–352 strict concurrency checking, 350–351 SqlDataSource class, 351, 454 SqlDataSource control, 349, 352, 354–356, 358, 360–364, 376, 381, 386, 388, 393, 399, 421–422, 426, 441, 444, 926, 1323 SqlDataSource tag, 443 SqlDataSourceStatusEventArgs.Exception property, 348 sqlexportonly switch, 805 SqlMembershipProvider class, 801–802, 809, 988 SqlProfileProvider, 900 anonymous profiles, 914–916 configuring provider, 903 creating profile tables, 901–903 defining profile properties, 904 overview, 900–901 profile groups, 908 profile serialization, 906–908 profiles and custom data types, 908–912 profiles API, 912–914 using profile properties, 905–906 SqlRoleProvider provider, 884 SqlServer setting, 237 SqlSiteMapProvider class, 627, 629 SqlWebEventProvider provider, 751 Src attribute, 553, 555 SSL (Secure Sockets Layer) encryption, 763 ST (session ticket), 851 stacked image controls, 1071 standardization, in ADO.NET, 250–251 Start( ) method, 455 Start Action group, Web tab of Properties window, 69 start tag, 995 StartCap member, 1084 StartFigure( ) method, 1083 StartFromCurrentNode control, 620, 622 StartFromCurrentNode property, 620, 622 StartingNodeOffset control, 622 StartingNodeOffset property, 621, 622 StartingNodeUrl property, 621 StartNavigationTemplate style, 612 StartNextButtonStyle style, 611 StartRowIndexParameterName property, 388, 390 starts-with, XPath expression, 489 state management, 211–243 application state, 240–243 ASP NET state management, 212, 214 changes in NET 2.0, 211 custom cookies, 229–230 overview, 211 Find it faster at http://superindex.apress.com/ SoapVersion property, 1205 Social Security numbers, regular expression, 152 SolidBrush class, 1086 Solution Explorer, 39, 742 Solution Explorer, Visual Studio IDE, 40–41 Sort( ) method, 382, 385 Sort property, DataView control, 381 Sorted event,GridView control, 384 SortExpression property, 368, 381 Sorting event, GridView control, 385 SortParameterName property, ObjectDataSource control, 382 source-code files, 165, 201 SourceForge, 729 spaghetti code, 4–5 element, 38, 1349, 1353, 1361, 1363 spanResult label, 1351 special characters HTML, 106–108 removal See SQL injection attack specific-length passwords, regular expression, 152 SQL, 443 SQL cache dependencies, 425 SQL cache notifications, 448–449 SQL injection attack, 266, 268, 306 SQL query, 303 SQL scripts, 741 SQL Server 2000 or cache notifications in creating the cache dependency, 453–454 enabling ASP NET polling, 452–453 enabling notifications, 450–451 how they work, 451–452 overview, 449 SQL Server 2005, 248 cache notifications in creating the cache dependency, 455 enabling, 454–455 overview, 454 SQL Server provider, 249–250, 256–257, 269–270 SqlCacheDependency class, 449, 455–456 SqlCacheDependency property, 441, 453 element, 452, 453 SqlCacheRegisterTableStoredProcedure table, 451 SqlCacheTablesForChangeNotification table, 450–451 sqlcmd.exe tool, 807 SqlCommand class, 389, 455 SqlCommand control, 1138 SqlDataAdapter control, 1138 SqlDataSource, 18 disadvantages of, 352–353 error handling, 348 handling extra options with, 363 overview, 341–342 parameterized commands, 344–348 selecting records, 342–344 1415 7680Index.qxd 1416 8/28/06 11:07 AM Page 1416 ■INDEX session state, 231–239 configuring, 234–239 overview, 231 securing, 239–240 session architecture, 231–232 using, 232–234 transferring information with cross-page posting, 224–225 getting page-specific information, 225–226 IsPostBack and IsCrossPagePostBack properties, 227–228 performing cross-page posting in any event handler, 226 transferring information with query string, 222–224 view state, 214–222 assessing, 219–221 example of, 215–216 making secure, 221–222 overview, 214 retaining member variables, 218–219 storing objects in, 216–218 state provider class, 231–232 StatefulService, 1196 statelessness of web applications, 74 StateServer, Mode setting, SessionState element, 235–236 StateServer setting, 235–236 static script blocks, 1299 static application variables, 241–243 static HTML tags, 36 static text, localizing, 670 section, 1137 StaticDisplayLevels property, Menu class, 646 StaticDynamicSelectedStyle style, 646 StaticHoverStyle style, 646 StaticMenuItemStyle style, 646 StaticMenuItemTemplate property, 647 StaticMenuStyle style, 646 StaticObjects HttpSessionState setting, 233 StaticPartialCachingControl object, 568 StaticSiteMapProvider class, 626–627, 630 StaticSubMenuIndent property, 646 Step Into command, 61 Step Out command, 62 Step Over command, 61 StepNavigationTemplate style, 612 StepNextButtonImageUrl property, 611 StepNextButtonStyle property, 611 StepNextButtonStyle style, 611 StepNextButtonText property, 611 StepNextButtonType property, 611 StepPreviousButtonStyle style, 611 StepStyle style, 611 StepType property, 607 storage location, state management options, 212 Store locations, 935 stored procedures, 270, 273–275, 288, 346 updating records with, 351–352 used for profiles, 902 StreamReader class, 535 streams, 534–544 binary files, 537–538 compression, 544–545 making files safe for multiple users, 540–544 creating unique filenames, 540–543 locking file access objects, 543–544 overview, 540 overview, 534–535 text files, 535–537 uploading files, 538–540 StreamWriter class, 535, 536 strict concurrency checking, 350–351 Strikeout property, FontInfo class, 133 String option, 907 string values, 557 StringBuilder, 261, 484, 1306 StringCollection class, 958 StringDictionary class, 956 String.Replace, 106 strings HTML encoding and decoding, 104 URL encoding and decoding, 104, 106 structured exception handling, 12 Structured Query Language (SQL), 352, 355, 381, 383, 426, 443–446, 758, 790, 806, 954, 988, 1301 Style Builder dialog box, Visual Studio, 36 Style class, 1033 Style collection, 122–123 style properties, 999–1002, 1033 style property, 119, 1291 Style2, 1034 StyleSheet property, 97, 573 stylesheets, XSLT, 158, 496 StyleSheetTheme attribute, 577, 582 subdirectories of virtual directories, 164, 174–175 Substitution control, 158, 425, 434 Subtitle member, IWebPart Interface, 1118 SuccessTemplateContainer template, 830 SumResultSets, 258 SuperSimpleReader example, 1032, 1034 SuperSimpleRepeater, 1030–1032, 1062 support for generics, 1171 See also SOAP; Web Services Description Language (WSDL) changes in NET 2.0, 1159–1160 consuming, 1178–1182, 1184–1192 creating ASP client with MSXML, 1189–1190 creating ASP client with SOAP toolkit, 1191–1192 creating ASP NET client, 1185–1187 creating Windows forms client, 1187–1189 dynamic URLs, 1184 generating proxy class with Visual Studio NET, 1181–1182 7680Index.qxd 8/28/06 11:07 AM Page 1417 ■INDEX System.Data.SqlClient.SqlClientFactory class, 280 System.dll, 47 System.Drawing namespace, 1077 System.Drawing.Design namespace, 1059 System.Drawing.dll assembly, 47 System.Drawing.Drawing2D namespace, 1077, 1083 System.Drawing.Graphics object, 1077 System.Drawing.Pens class, 1084 System.EnterpriseServices assembly, 1198 System.EnterpriseServices.dll assembly, 47–48 System.Globalization namespace, 651, 661 System.IO namespace, 517 Directory class, 518, 523–524 retrieving information about files, 518 System.IO.Compression namespace, 925 System.IO.MemoryStream object, 1089 System.Management namespace, 752 System.MarshalByRefObject class, 1174 System.Messaging namespace, 457 System.Net.HttpCookie object, 230 SystemOperator value, WindowsBuiltInRole enumeration, 856 System.Resources namespace, 651 System.Security namespace, 934 System.Security.AccessControl namespace, 934 System.Security.Cryptography namespace, 173–174, 925, 934, 937, 944, 981 System.Security.Cryptography.X509Certificates namespace, 934, 936 System.Security.Cryptography.Xml namespace, 934 System.Security.Principal namespace, 777 System.Security.Principal.GenericIdentity class, 777 System.Security.Principal.IPrincipal, 107 System.Security.Principal.WindowsIdentity class, 777 System.Text namespace, 947 System.Threading.Thread class, 1248 System.Threading.Thread.CurrentCulture property, 671 System.Threading.Thread.CurrentUICulture property, 671 section, 808 system.web element, web.config files, 177 System.Web namespace, 622, 626 element, 785, 875, 894 System.Web.Compilation namespace, 674 System.Web.dll assemblies, 199 System.Web.dll assembly, 47 System.Web.Hosting namespace, 745 System.Web.HttpCachePolicy class, 431 System.Web.HttpContext class, 113 System.Web.Management namespace, 749 System.Web.Mobile.dll assembly, 47 System.Web.Profile namespace, 913, 923 System.Web.Profile.SqlProfileProvider class, 903 Find it faster at http://superindex.apress.com/ overview, 1178–1179 proxy class, 1184 distributed computing and web services, 1161–1163 history of, 1160–1161 making money with, 1165 overview, 1159–1160, 1247 problems with distributed component technologies, 1163 refining, 1192–1200 BufferResponse, 1198 CacheDuration, 1192–1195 EnableSession, 1195–1197 overview, 1192 Transaction Option, 1198–1200 securing, 1258–1266 authorizing users, 1264 custom ticket-based authentication, 1261 overview, 1258 testing SOAP authentication system, 1264–1266 tracking user identity, 1262–1263 Windows authentication, 1258–1261 standards and extensions, 1201–1231 web service stack, 1165–1168 describing a web service, 1167 finding web services, 1166–1167 overview, 1165–1166 wire format, 1167–1168 web services enhancements, 1275–1282 installing WSE, 1276 overview, 1275–1276 performing authentication with WSE, 1278–1282 Windows authentication, 1260, 1265 WS-interoperability, 1201–1203 SwitchViewByID command, 604 SwitchViewByIDCommandName field, 604 SwitchViewByIndex command, 604 SwitchViewByIndexCommandName field, 604 symmetric encryption, 768–769, 938–939 SymmetricAlgorithm class, 937, 946–947 SymmetricEncryptionUtility class, 948–949 Sys.Data.DataSource object, 1362 system web element, 178 System.Collections.CollectionBase class, 919 element, 721 System.ComponentModel namespace, 356, 1038 System.Configuration namespace, 180–181, 923 System.Configuration.dll assembly, 47 System.Configuration.Install.Installer, 739 System.Configuration.Provider namespace, 751, 923, 971 System.Data namespaces, 252 System.Data.Common.DbProviderFactories class, 280 System.Data.dll assembly, 47 System.Data.OracleClient.dll assembly, 47 1417 7680Index.qxd 1418 8/28/06 11:07 AM Page 1418 ■INDEX System.Web.Security namespace, 777, 784, 836, 963, 970 System.Web.Security.FormsIdentity class, 777 System.Web.Security.MembershipProvider namespace, 801 System.Web.Security.PassportIdentity class, 777 System.Web.Services.dll assembly, 47 System.Web.Services.WebMethod attribute, 1172–1173 System.Web.SessionState.HttpSessionState class, 233–234 System.Web.UI namespace, 393 System.Web.UI.Control namespace, 822 System.Web.UI.HtmlControls namespace, 118 System.Web.UI.Page base class, 671 System.Web.UI.Page namespace, 776 System.Web.UI.WebControl namespace, 128 System.Web.UI.WebControls namespace, 147, 833, 1114 System.Web.UI.WebControls.Style class, 1033 System.Web.UI.WebControls.WebControl, 994 System.Web.UI.WebControls.WebParts namespace, 1114, 1122, 1124 System.Web.UI.WebControls.WebParts property, 1122 System.Xml namespace, 477, 655, 961 System.Xml.dll assembly, 47 T TabIndex property, 129 Table controls, 130 < table> element, 38, 1010 TableAdapters, 316–317 TableCell controls, 130 TableRow controls, 130 Tables property, 1007 Tabular Data Stream (TDS) protocol, 250–252 Tag Specific Options button, 38 TagName, 119, 996 tagName property, 1291 TagName property, HTML server controls, 119 TagPrefix, 996, 1040 tags automatically encoded, 106 closing, 131 tag prefixes, 553 Target property, 636, 644 Task List, Visual Studio, 39 Task List, Visual Studio IDE, 42–44 TCP/IP, 689, 697 template containers, 1026 template controls, 1026–1036 creating, 1026–1029 overview, 1026 styles, 1033–1036 using customized templates, 1029–1032 TemplateContainer attribute, 1030 TemplateControl class, 552 TemplateField column, 367, 410 TemplateField control, 392 templates GridView control and binding to methods, 396–397 editing in Visual Studio, 395–396 editing with, 398–403 handling events in, 397–398 multiple, 394 overview, 392–394 PasswordRecovery templates, 828–830 templates, for websites See master pages templates, Visual Studio, 29 TerraService, 1189 TerritoriesService class, 1342 TerritoriesService proxy, 1343 Territory class, 1342 Territory objects, 1344 TestCompiledMerged.dll, 730 testing connection, 254–255 data access components, 295–296 disabling caching while testing, 428 FactoredProfileProvider, 930–932 SOAP authentication system, 1264–1266 web services, 1175–1177 text encoding, 536 text files, 535–537 Text property, 148, 635, 643, 647 TextAlign property, 141 TextBox class, Atlas Client, 1349 TextBox control, 130, 579, 658, 833 TextBoxStyle style, 817 TextBoxWatermark, 1376 TextChanged event, 911, 1370 TextRenderingHint property, Graphics class, 1080 TextureBrush, 1086 Thawte certificate authority, 768 Theme attribute, 577, 581 themes applying a simple theme, 576–577 applying dynamically, 582–584 applying through configuration files, 582 folders, 575–576 handling theme conflicts, 577–578 overview, 571, 574–575 skins, 575–576 multiple, creating for same control, 578–579 with templates and images, 579–581 using Cascading Style Sheets (CSS) in, 581 Thread class, 462 thread pool, 460 thumbnail page, 1090–1093 ThumbnailViewer.aspx, 1092 Tick event, 1371 ticket-granting service, 851 Time data types, 371 TimeConsumingPage.aspx, 1292 7680Index.qxd 8/28/06 11:07 AM Page 1419 ■INDEX nested, 279–280 savepoints, 279 stored procedure transactions, 274–275 Transfer, HttpServerUtility, 105 Transfer( ) method Server class, 583, 609, 633 ServerUtility class, 105 TransferFunds method, 1198 transferring information with cross-page posting, 224–225 getting page-specific information, 225–226 IsPostBack and IsCrossPagePostBack properties, 227–228 performing cross-page posting in any event handler, 226 with query string, 222–224 Transform method, 497, 1083 Transform property, XmlDataSource, 507 transformers, 1354 transforming XML files, 496, 498 Transmission Control Protocol (TCP), 698 TreeNode class, 635–637, 643 TreeNode control, 635, 638 TreeNodeDataBinding elements, 506 TreeNodeDataBound control, 625 TreeNodePopulate event, 638–639 TreeNodeStyle class, 639 TreeView class, 20, 32, 505–507, 644 TreeView control, 158, 581, 601, 616–617, 620, 623, 625, 636, 643, 645–646, 649, 1314, 1328 overview, 634–635 populating nodes on demand, 638–639 styles applying to node levels, 641–642 applying to node types, 641 overview, 639, 641 themes, 642 TreeNode object, 635–637 Triple Data Encryption Standard (3DES), 173–174 See also encrypting data TripleDES class, 938–939, 945 Trust for Delegation setting, 862 type attribute, 895, 904 type converters, 1045–1053 attaching, 1050–1051 control with object properties, 1046–1047 creating a custom type converter, 1048–1050 ExpandableObjectConverter, 1051, 1053 overview, 1045 Type property CompareValidator control, 149 CompareValidator controls, 149 HtmlInputControl, 120 HttpBrowserCapabilities, 1006 RangeValidator control, 149 type safety, 11 type sharing, 1231–1233 Find it faster at http://superindex.apress.com/ timed refreshes, 1371–1372 Timeout, HttpSessionState setting, 233 timeout configuration, 694 timeout option, 786 timeouts, 1186–1187 TimerControl, 1371 TimeSpan.Zero, 437 timestamp-based updating, 294 timout setting, 239 Title attribute, 596 Title member, IWebPart Interface, 1118 Title property, 97, 559, 607 Title property, WebPart class, 1116, 1120 TitledTextBox control, 1019 TitledTextBox.TextChanged event, 1020 TitleIconImageUrl member, IWebPart Interface, 1118 TitleIconImageUrl property, 1120 TitleImageUrl property, WebPart class, 1121 titles, specifying for content pages, 596 TitleText property, 817 TitleTextStyle style, 817 TitleUrl member, IWebPart Interface, 1118 TitleUrl property, WebPart class, 1116, 1120, 1132 ToBase64String( ) method, Convert class, 948, 957 TODO token tag, 43–44 ToggleButtonExtender, 1376 Token member, WindowsIdentity object, 856 Token property, WindowsIdentity, 866 token tags, 43 Toolbox, 39, 998, 1042 toolbox, custom controls, 1001–1002 Toolbox, Visual Studio IDE, 42 ToolTip property, 129, 635, 643 ToString( ) method, 371, 662, 956–957 ToString Custom Type Converter, 1048 ToString transformer, 1354 ToXmlString( ) method, 950 Trace Information, Trace Log, 107 trace listener, 109 Trace object, 107–111 trace.axd application extension, 111, 197 trace.axd file, 692 TraceMode attribute, 108 TraceMode property, 108 tracepoints, 64 TraceWebEventProvider provider, 752 tracing application-level traces, 110–111 with ASP NET Development Helper, 112 attributes, 111–112 tracking users, 1262–1263 trailing backslash, Path, 528 TransactionOption property, 1192, 1198–1200 transactions, 273–274 client-initiated, 276–277 isolation levels, 278 1419 7680Index.qxd 1420 8/28/06 11:07 AM Page 1420 ■INDEX typed DataSets creating, 317–318 custom TableAdapters, 316–317 overview, 315–316 parts of, 318–320 using, 320–322 TypeName property, 354 types, section, 1235 U u option, 724 U switch, 805 UDDI (Universal Description, Discovery, and Integration), 1166–1167 UI effects, 78 UICulture property, Page class, 671 UITypeEditors, 35, 1059 Underline property, FontInfo class, 133 Underused value, CacheItemRemovedReason enumeration, 448 Undo( ) method, WindowsImpersonationContext object, 867 UninstallPersistSqlState.sql, 237 UninstallSqlState.sql, 237 unique filenames, 540–543 UniqueID, 1015 Unit structure, 131 Units, measurement, 131 UnitType enumeration, 132 Unlock, Application object, 240 UnlockUser( ) method, 839 Update( ) method, 301, 363 update command, 350, 399 UPDATE statement, 420–421 Update Web Reference, 1182 UpdateCommand property, 301, 342 UpdateMethod command, 359 UpdateMethod property, 354 UpdatePanel control, 1368–1371 UpdateParameters collection, 352, 358, 360 UpdateProgress control, 1372 UpdateProgressMeter( ) method, 1293 UpdateRequestCache, Application event, 169 UpdateUser( ) method, 839 updateUserProcedure attribute, 925 updating records, SqlDataSource and KeyFields, 350 overview, 348–350 with stored procedures, 351–352 strict concurrency checking, 350–351 uploading files, 538–540 uploading Web Parts, 1148–1152 Uri type, System object, 528 URL dynamic, 1184 encoding, 105–107, 223 mapping, 632–633 modified URL (munged URL), 232, 238 processing, and Internet Information Services (IIS), 690, 692 url attribute, 615, 621, 632 URL authorization, 871 authorization rules controlling access for specific roles, 876–877 controlling access for specific users, 873–874 controlling access to specific directories, 874–875 controlling access to specific files, 875–876 overview, 872–873 overview, 871 url or path parameter, 1180 Url property, HttpRequest class, 102 UrlAuthorization module, 775 UrlAuthorizationModule, 871, 874 UrlDecode( ) method, ServerUtility class, 104 UrlEncode( ) method, 104, 106, 956 URL-encoded, 1092 section, 632 UrlReferrer property, HttpRequest class, 102 Use IIS Metabase Path for Source Input option, 734 UseCookies option, 786, 794 UseDeviceProfile option, 786, 794 element, 793 User class, 776 User Code initialization, 88 user controls, 551–568 adding code to, 554–564 adding events, 560–563 adding properties, 556–557 exposing inner web control, 563–564 handling events, 554–556 overview, 554 using custom objects, 558–560 and advanced Web Parts, 1144–1147 converting page to, 554 creating, 552–553 dynamically loading, 564–567 overview, 564 portal frameworks, 565–567 overview, 551–552 partial page caching, 568 sharing cached controls, 570 VaryByControl property, 568–569 user identity, tracking, 1262–1263 User member, WindowsIdentity object, 856 User object, 107, 775 User property, 774, 776, 784, 1173 User value, WindowsBuiltInRole enumeration, 856 UserAgent property, HttpRequest class, 102 UserControl object, 564 user-defined data types, 251 UserHostAddress property, HttpRequest class, 102 UserHostName property, HttpRequest class, 102 UserIsOnlineTimeWindow property, 983 7680Index.qxd 8/28/06 11:07 AM Page 1421 ■INDEX UserLanguages property, 102, 661 UserLookupError event, 827 username configuration, 695 UserName property, 817 UserNameLabelText property, 817 UsernameRequiredErrorMessage property, 817 UserNameTemplateContainer template, 830 Users_GetByUserName procedure, 930 Users_Update procedure, 930 UserStore class, 963, 981 UseUri option, 786, 794 UtcLastModified property, 456 UTF-7 Unicode, 536 UTF-8 Unicode, 536, 948 V Find it faster at http://superindex.apress.com/ Validate( ) method, Page class, 792 Validate method, validation controls, 148 validateRequest attribute, 1303 ValidateRequest Page directive, 1303 ValidateUser( ) method, 983 ValidateUserInternal( ) method, 981 validation, 900 automatic, 146–147, 153 client-side input, 144, 146, 153 controls for, 89, 116, 145–146 and cross-page posting, 228–229 manual, 146–147 process of, 146–147 routine, 153 XHTML, 85 XML files, 493–495 validation control classes, 147 validation controls, properties, 148 ValidationEventArgs class, 495 ValidationEventHandler event, 495 ValidationExpression property, 150 validationKey value, 173–174 ValidationProperty attribute, 146 ValidationResources class, 670 ValidationSummary control, 145, 154 ValidationSummary controls, 145 ValidatorTextStyle style, 817 Value property, 120, 122–123, 145, 635, 643, 1291 ValueToCompare property, CompareValidator control, 149 variable watch windows, 62 variable watches, 62–63 variables, member, 168 variant data types, VaryByControl property, 568–569 VaryByCustom attribute, 430 VaryByHeader attribute, 431 VaryByParam attribute, 427–429, 435 VaryByParam parameter, 568 vary-by-parameter caching, 429 vb files, 41 VBMake tool, 729 VBScript property, 1007, 1286 verbs, custom, 1143–1144 verbs attributes, 199 Verbs property, 1117, 1144 VerifyingAnswer event, 827 VerifyingUser event, 827 Verisign certificate authority, 768 Version property, 1006 VerticalPadding property, 639 View control, 158 view state, 74, 79–82, 99–100, 212–222 assessing, 219–221 chunking, 73, 83 data types, 212 example of, 215–216 lifetime, 212 making secure, 221–222 overview, 214 performance, 212 retaining member variables, 218–219 scope, 212 security, 212 state management options, 212 storage location, 212 storing objects in, 216–218 ViewState, 1011–1013 ViewState collection, 303 ViewState data, 1011–1013 virtual directories, 164–165, 174–175, 743 creating, 704–706 getting, 101 and web applications, 706–707 website management, 704 virtual directory folder, 736 virtual path, 675 virtualPath member variable, 683 VirtualPathProvider class, 689, 743–748 visibilityMode property, 1353 Visible property, 118, 368, 602 VisibleWhenLoggedIn property, 818 Visual Studio deploying ASP NET applications with, 727–736, 738–743 editing templates in, 395–396 Visual Studio 2005, 16–17 and ASP NET coding model how code-behind files are connected to pages, 54–55 how control tags are connected to page variables, 55, 57 how events are connected to event handlers, 57–58 overview, 52–54 ASP NET Development Helper, 70–71 changes from previous versions, 25–26 Code Editor adding assembly references, 46–48 error underlining, 50, 52 1421 7680Index.qxd 1422 8/28/06 11:07 AM Page 1422 ■INDEX member list, 50 outlining, 49 overview, 45–46 debugging advanced breakpoints, 63–64 overview, 58–59 single-step, 59–60, 62 variable watches, 62–63 JavaScript debugging service, 1291 macros, 64–66 overview, 25 Visual Studio IDE, 27–28 document window, 41 Error List and Task List, 42–44 overview, 39 Server Explorer, 44–45 Solution Explorer, 40–41 Toolbox, 42 Web Application Projects migrating existing projects, 68 new configuration settings, 68–69 overview, 66–68 websites in designing web pages, 33–37 formatting HTML, 37–38 migrating projects, 31 overview, 28–30 projectless development, 30–31 Visual Studio Automation model, 64 Visual Studio IDE, 27–28 document window, 41 Error List and Task List, 42–44 Server Explorer, 44–45 Solution Explorer, 40–41 Toolbox, 42 Visual Studio NET additional features, using, 47 Breakpoints window, 63 custom controls in, 998 generating proxy class with, 1181–1182 New Project window, 28 variable watch windows, 62 Visual Studio Properties window, 736 Visual Studio Team System, 26 Visual Studio template, 1337 Visual Studio Toolbox, 1338 Visual Studio Web Deployment Projects package, 728 W \w character class, 790 w parameter, aspnet_merge.exe, 731 \w* expression, 988 W3WP.EXE process, 698 w3wp.exe utility, 718 WaitForMessage( ) method, 457 WANs (wide area networks), 1161 warn method, trace log, 109–110 Warp method, 1083 WAS tool, 698 Watch variable watch window, Visual Studio NET, 62 tag>, 658 tag, 658 tag, 658 Web Application Folder, 736 web applications and application pools, 714 and DataSet, 297–298 and virtual directories, 706–707 Web Control events, 137–139 web controls, 79, 123–125, 138 adding, Visual Studio NET, 33 extending existing, 1019–1026 composite controls, 1019–1021 derived controls, 1021–1026 overview, 1019 Web controls, vs HTML controls, 13–14 Web Deployment Projects package, 729, 732 Web development, evolution of, web form (.aspx) files, 552 Web Form controls, 116, 128–139 basic web control classes, 129–131 Colors, 132 default button, 135–136 enumerated values, 132 Focus( ) method, 134–135 Fonts, 133–134 handling Web Control Events, 137–139 overview, 137–138 ServerClick Event and HtmlInputImage control, 138–139 overview, 128 properties AccessKey property, 129 BackColor property, 129 BorderColor property, 129 BorderWidth property, 129 CssClass property, 129 Enabled property, 129 Font property, 129 ForeColor property, 129 Height property, 129 Width property, 129 scrollable panels, 136–137 Units, 131 WebControl base class, 129 Web Form designer, Visual Studio NET, 27 Web Forms, 73–80, 82, 87–102, 105–111, 113 changes in NET 2.0, 73 overview, 73 page as control container, 93–100 dynamic control creation, 98–100 overview, 93 showing control tree, 93–97 7680Index.qxd 8/28/06 11:07 AM Page 1423 ■INDEX customizing page, 1111–1113 simple Web Part tasks, 1114–1118 create typed DataSets, 1123 custom WebPart’s skeleton, 1124 customization steps, 1129 developing advanced Web Parts, 1122–1123 final rendering, 1128 implementing IWebPart interface, 1118–1121 initializing WebPart, 1124 initializing WebPart “ \r ” jalambcomWE21t210, 1125 loading data and processing events, 1125–1127 using WebPart, 1129–1130 uploading Web Parts dynamically, 1148–1152 user controls and advanced Web Parts, 1144–1147 Web Part editors, 1130–1135 WebPartManager and WebPartZones, 1107–1108 Web parts administration, 22 ASP NET 2.0, 22 web parts controls, 116 web reference, 1181 Web resources, 1043–1045 Web Service basic data types, 1170 web service callbacks calling web service with JavaScript, 1343–1345 creating Atlas web service, 1340–1343 overview, 1340 placing web method in page, 1345–1346 web services asynchronous calls, 1247–1258 asynchronous services, 1257–1258 concurrent asynchronous calls, 1252–1253 overview, 1247–1248 responsive Windows clients, 1253, 1255–1256 simple asynchronous call, 1250–1251 Atlas, 1336 benefits of, 1163–1164 building, 1168–1177 exposing web service, 1172–1175 overview, 1168 testing web service, 1175–1177 web service class, 1168–1169 web service requirements, 1169–1171 Web Services Description Language (WSDL), 1166–1167, 1174, 1201–1203, 1216–1222, 1223, 1234–1236 definition, 1216 overview, 1216 viewing for web service, 1216–1222 basic structure, 1218–1219 binding section, 1221–1222 message section, 1220–1221 Find it faster at http://superindex.apress.com/ Page class, 100–102, 105–111 accessing HTTP context in another class, 113 overview, 100 Request object, 101 Response object, 102 Server, 105–107 Server object, 104 Session, Application, and Cache objects, 100 Traceobject, 107–108 tracing with ASP NET Development Helper, 112 User object, 107 page header, 97–98 page processing, 74–80, 82 the ASP NET Event Model, 76–77 automatic postbacks, 77–79 dynamic user interfaces, 76 HTML forms, 74–76 overview, 74 view state, 79–82 view state chunking, 83 processing stages, 87–92 automatic data binding, 89–90 cleanup, 90 event handling, 89 overview, 87–88 page flow example, 90–92 page framework initalization, 88 page framework initialization, 88 User Code initialization, 88 validation, 89 Web Matrix, 16–17 web method code, 1345 web methods, 1346 web pages buffering server output, 103 caching, 103 current address, 102 previous page address, 102 transferring execution to another, 105 transferring information between, 102 transferring user to another, 103 Web Part pages, 1105 See also portals adding Web Parts to page, 1108–1111 connecting Web Parts, 1136–1137 authorizing Web Parts, 1153–1154 clearing personalization, 1155 defining communication contract, 1137 dynamically configuring connection points, 1142–1143 final tasks for personalization, 1154 implementing provider, 1137–1139 multiple connection points, 1142–1143 static connections between WebParts, 1141–1142 creating page design, 1105–1106 and custom verbs, 1143–1144 1423 7680Index.qxd 1424 8/28/06 11:07 AM Page 1424 ■INDEX portType section, 1221 service section, 1222 types section, 1219–1220 WSDL document, 1218 Web tab, of Properties window, 68 WebApplicationLifetimeEvent class, 749 WebBrowsable attribute, 1124 web.config file ASP.NET applications, 41 Atlas, 1337 credentials store in, 787–788 hashing passwords in, 793 WebConfigurationManager.ConnectionStrings collection, 254 WebControl class, 129, 994, 999–1002, 1019 WebControl constructor, 1000 WebControls namespace BaseValidator class, 148, 151–152 validation control classes, 147 WebErrorEvent class, 749 WebForm_AutoFocus( ), 134 webGarden configuration, 695 WebHandler directive, 201 WebHeartBeatEvent class, 749 WebMethod attribute, 1174, 1192, 1202, 1268, 1359 WebPart class, System.Web.UI.WebControls.WebParts namespace, 1114 WebPart control, 670, 1115, 1117 WebPartDisplayMode enumeration, 1111–1112 WebPartManager class, 1107–1108, 1115, 1153, 1155 WebPartManager control, 1105, 1110, 1112, 1137, 1141, 1154 WebParts class, System.Web.UI.WebControls namespace, 1114 WebParts collection, WebPartManager class, 1115 element, 1154 WebPartToEdit property, 1134 WebPartVerb, 1144 WebPartVerbCollection, 1144 WebPartZone control, 1105, 1109, 1114–1115, 1117, 1129 WebRequestErrorEvent class, 749 WebRequestEvent class, 749 WebResource attribute, 1290, 1309 WebService attribute, 1172–1175, 1232 WebService class, 1173–1174 WebServiceBinding attribute, 1202–1203 webServices element, web.config files, 177 section, 1340 Website Administration Tool (WAT), 184–185 website deployment deploying ASP.NET applications ASP.NET side-by-side execution, 720 compilation models, 722–726 configuring HTTP runtime settings, 721–722 creating MSI setup packages, 735–736, 738–743 overview, 717–718 verifying the ASP NET installation, 718–720 with Visual Studio, 727–728 Visual Studio web deployment projects, 728–735 health monitoring in ASP NET 2.0 basic structure, 749 events and providers, 749–752 overview, 748 Internet Information Services (IIS) IIS 5.x process model, 693–694, 696–697 IIS 6.x process model, 697–698, 700–701 installing, 701–703 overview, 689 request processing with IIS and ASP.NET, 692–693 and URL processing, 690, 692 managing application pools in IIS 6.0 application pools and web applications, 714 creating application pools, 711–712, 714 custom application pool identities, 714–717 overview, 711 managing websites creating virtual directories, 704–706 folder settings, 707–710 overview, 704 virtual directories and web applications, 706–707 overview, 689 VirtualPathProvider class in ASP.NET 2.0, 743–748 website navigation Menu control menu templates, 647–649 overview, 643–645 styles, 646–647 overview, 601 pages with multiple views MultiView control, 602–606 overview, 601–602 Wizard control, 606–613 site maps adding custom site map information, 625 binding other controls, 623–624 binding portions of, 619–622 binding to, 616–617 breadcrumbs, 617–619 creating custom SiteMapProvider, 626–632 defining, 614–615 overview, 613–614 security trimming, 633–634 site map object, 622–623 URL mapping, 632–633 7680Index.qxd 8/28/06 11:07 AM Page 1425 ■INDEX WindowsBuiltInRole enumeration, 855, 878 window.serInterval( ) method, 1293 WindowsIdentity class, 856–857 implements IIdentity interface, 777 System.Security.Principal namespace, 777 WindowsIdentity object, 854, 856 WindowsImpersonationContext object, 867 WindowsPrincipal class, 854–855 WindowsTokenRoleProvider class, Roles Service, 885, 890 Wizard control, 158, 602, 611, 613, 649 events, 609–610 overview, 606 steps, 607–609 styles and templates, 611–613 WizardStepType enumeration, 607 WmiWebEventProvider provider, 752 word run, 658 worker process, 164, 166 World Wide Web Consortium (W3C), 472, 477, 698, 934 WriteAllText( ) method, File class, 519 WriteAttribute method, 995 WriteBeginTag method, 995 WriteBytes( ) method, File class, 519 WriteComment( ) method, 479 WriteEndElement( ) method, XmlTextWriter class, 479–480 WriteEndTag method, 995 WriteFile( ) method, HttpResponse class, 104 WriteLine( ) method, StreamWriter class overloading, 536 reading and writing flat files, 536 WriteLine method, StreamWriter object example, 536 WriteLines( ), File class, 519 WriteStartDocument, 478 WriteSubstitution( ) method, 432, 433–434 writeToDiagnosticsTrace option, 112 WriteToLog( ) method, 1271 WriteXml, 478, 510 WriteXml( ) method, IXmlSerializable interface, 1234, 1237–1238 WriteXml method, ADO.NET DataSet class, 511 WriteXmlSchema method, 300, 510 wsdl.exe utility, 1179–1180, 1233 wsdlHelpGenerator element, 1177 WSE, installing, 1276 WS-Interoperability, 1201–1203 X X509 certificate, 716, 767, 934 XCopy deployment, 735 XHTML compliance, 83–84 diabling rendering, 86 document type definitions, 84–85 Find it faster at http://superindex.apress.com/ TreeView control overview, 634–635 populating nodes on demand, 638–639 styles, 639, 641–642 TreeNode object, 635–637 Web.sitemap file, 614, 616, 621 websites See also master pages; themes standardizing formatting for Cascading Style Sheets (CSS), 571–574 overview, 571 standardizing layout for, 584 websites, in Visual Studio 2005 designing web pages formatting HTML, 37–38 HTML tables, 36–37 overview, 33–35 smart tags, 35 static HTML tags, 36 migrating projects, 31 overview, 28–30 projectless development, 30–31 WebUIValidation.js, 1290 well-formed XML, 474–475 When Hit option, 64 WHERE clause, 350, 390, 420, 443 Widen method, 1083 Width member, 1084 Width property, 129, 1045 wildcards, 429, 526 Win16 property, 1006 Win32 property, 1006 window.onload event, 1348 window.open function, 1305 Windows 2000, impersonation in, 859–860 Windows account permissions See permissions Windows authentication, 761 advantages, 843, 845 Basic authentication, 846 Digest authentication, 846–847 disadvantages, 845 impersonation configured, 863–865 and delegation on Windows Server 2003, 861–862 overview, 859 in Windows 2000, 859–860 in Windows XP 860–861 , securing web services, 1258–1261 web services, 1260, 1265 Windows data protection API (DPAPI), 933 Windows forms client, 1187–1189 Windows Forms, using membership in, 840–842 Windows Installer, 736 Windows Messaging Queuing (MSMQ), 457 Windows roles, defaults, 855–856 Windows Server 2003, 711, 861–862 Windows XP, impersonation in, 860–861 WindowsAuthenticationModule class, 775 1425 7680Index.qxd 1426 8/28/06 11:07 AM Page 1426 ■INDEX support, Web Forms, 73 validating, 85 XHTML 1.0 frameset doctype, 85 XHTML 1.0 transitional, 85 xhtml11Conformance element, enableObsoleteRendering attribute, 86 XhtmlTextWriter class, 1004 XML, 3, 15, 158, 471–479, 481, 483–496, 498, 510–516 and ADO.NET, 510–516 accessing DataSet as XML, 512–514 converting DataSet to XML, 511–512 executing XML query, 514–516 overview, 510–511 changes in NET 2.0, 471 configuration files See configuration files integration into DataSet, 298 introduction to, 472–475 advantages of XML, 473–474 overview, 472–473 well-formed XML, 474–475 XML namespaces, 475–476 XML schemas, 476–477 overview, 471 XML, in ASP NET, 477–479, 481, 483–496, 498–510 data binding binding XML content from other sources, 509 hierarchical binding with TreeView, 505–507 nested grids, 504–505 nonhierarchical binding, 499–501 overview, 499 updating XML through XmlDataSource, 510 using XPath, 501–503 using XSLT, 507–509 overview, 477 reading and navigating XML files, 481, 483–496, 498 overview, 481 searching XML documents, 486–488 searching XML documents with XPath, 489–490 transforming XML files, 496, 498 using XML DOM, 481, 483–484 using XmlTextReader, 490–493 using XPathNavigator, 485–486 validating XML files, 493–495 writing XML files, 478–479, 481 XML content, 1024 Xml control, 498, 513–514, 1024 XML DOM (Document Object Model), 477, 481, 483–484 XML markup languages (XML grammars), 475 XML namespace, 1174–1175 Xml option, 907 Xml rich control, 116, 158 XML schedule file, AdRotator control, 158 XML schema, 493 XML Schema Document (XSD), 1234 XML serialization customizing with IXmlSerializable, 1234 overview, 1233–1235 schemas for custom data types, 1235–1236 XmlDataDocument class, 513 XmlDataSource control, 339, 426, 441, 471, 499, 510, 637 xmldocs parameter, aspnet_merge.exe, 731 XmlDocument class, 478, 481, 482, 490, 492, 657–658 XmlElement attribute, 1232 XmlElement object, 487 XMLHttpRequest object, 1315–1316, 1321 handling responses, 1316–1317 sending requests, 1316 XmlLabel code, 1025 XmlLabel control, 1024, 1046 XmlMembershipProvider class, 963, 967, 970–971, 976, 988 XmlNode class, 483, 486–487, 1170 XmlNodeList class, 482 XmlNodeList object, 482–483, 486 xmlns attribute, 475–476 XmlQualifiedName class, 1236 XmlReader class, 515, 1234 XmlRoleProvider class, 963, 983–988 XmlRoot attribute, 1232 XmlSchemaException exception, 495 XmlSchemaProvider attribute, 1236, 1243 XmlSchemaProvider class, 1234 XmlSerializer class, 717, 910, 966, 970 XmlSiteMapProvider class, 633 XmlSiteMapProvider control, 613–615, 619, 621, 626 XmlTextReader class, 481, 490–493 XmlTextWriter, 478, 492 XmlValidatingReader object, 495 XmlWriter class, 1234 XPath, 489–490, 501–503, 624, 658 XPath property, XmlDataSource, 503 XPathNavigator class, 481, 485–486, 490, 497 XPathNodeType property, 486 XPathSelect( ) method, 504 XSD (XML schema document), 316 XSL (Extensible Stylesheet Language), 496–497 XSLT stylesheets, 158, 1024 XslTransform class, 497 Z Zone property, WebPart class, 1117 ZoneIndex property, WebPart class, 1117 ZoneTemplate controls, 1148 ... in ASP. NET 2.0 are fixes for existing features Instead, ASP. NET 2.0 keeps the same underlying plumbing and concentrates on adding new, higher-level features In other words, ASP NET 2.0 contains... regular contributor to programming journals and the author of more than a dozen books about NET programming, including Beginning ASP NET 2.0 in C# 2005 (Apress, 2006), Microsoft NET Distributed Applications... milestone, ASP NET 2.0 ASP NET 1.1 was released late in 2003, solidifying ASP. NET as the web development platform of choice for professional developers Two long years later, ASP. NET 2.0 finally appeared

Ngày đăng: 22/08/2013, 14:06

Từ khóa liên quan

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

Tài liệu liên quan