2006 apress beginning asp net 2 0 in c sharp 2005 from n

1.2K 98 0
2006   apress   beginning asp net 2 0 in c sharp 2005 from n

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

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

Thông tin tài liệu

MacDonald.book Page i Friday, December 30, 2005 12:59 PM Beginning ASP.NET 2.0 in C# 2005 From Novice to Professional ■■■ Matthew MacDonald MacDonald.book Page ii Friday, December 30, 2005 12:59 PM Beginning ASP.NET 2.0 in C# 2005: From Novice to Professional Copyright © 2006 by Matthew MacDonald 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 (pbk): 978-1-59059-572-5 ISBN-10 (pbk): 1-59059-572-6 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 Contributor of Chapter 27: Julian Templeman Lead Editor: Jonathan Hassell Technical Reviewer: Ronald Landers Editorial Board: Steve Anglin, Dan Appleman, Ewan Buckingham, Gary Cornell, Jason Gilmore, Jonathan Hassell, Chris Mills, Dominic Shakeshaft, Jim Sumser Project Manager and Production Director: Grace Wong Copy Edit Manager: Nicole LeClerc Copy Editor: Kim Wimpsett Assistant Production Director: Kari Brooks-Copony Production Editor: Kelly Winquist Compositor: Pat Christenson Proofreader: Nancy Riddiough Indexer: Michael Brinkman 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 `cUVcd_j1dacZ_XVcdS^T`^, or visit Yeea+ hhhdacZ_XVc`_]Z_VT`^ 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 Z_W`1RacVddT`^, or visit Yeea+ hhhRacVddT`^ 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 Yeea+ hhhRacVddT`^ in the Source Code section You will need to answer questions pertaining to this book in order to successfully download the code MacDonald.book Page iii Friday, December 30, 2005 12:59 PM For my loving wife, Faria MacDonald.book Page iv Friday, December 30, 2005 12:59 PM Contents at a Glance About the Author xxvi About the Technical Reviewer xxvii Acknowledgments xxviii Introduction xxix PART ■■■ ■CHAPTER Introducing the NET Framework Learning the C# Language 23 Types, Objects, and Namespaces 59 Introducing Visual Studio 2005 91 ■CHAPTER ■CHAPTER ■CHAPTER PART ■■■ ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER 10 ■CHAPTER 11 ■CHAPTER 12 PART ■CHAPTER 14 ■CHAPTER 15 ■CHAPTER 16 ■CHAPTER 17 Developing ASP.NET Applications Web Form Fundamentals 125 Web Controls 175 Tracing, Logging, and Error Handling 219 Validation and Rich Controls 267 State Management 317 Master Pages and Themes 359 Website Navigation 389 Deploying ASP.NET Applications 427 ■■■ ■CHAPTER 13 iv Introducing NET Working with Data ADO.NET Fundamentals 471 Data Binding 539 The Data Controls 581 Files and Streams 625 XML 655 MacDonald.book Page v Friday, December 30, 2005 12:59 PM PART ■■■ ■CHAPTER 18 ■CHAPTER 19 ■CHAPTER 20 PART ■CHAPTER 22 ■CHAPTER 23 PART Security Fundamentals 707 Membership 739 Profiles 781 ■■■ ■CHAPTER 21 ■CHAPTER 25 ■CHAPTER 26 ■CHAPTER 27 Web Services Web Services Architecture 813 Creating Web Services 831 Enhancing Web Services 869 ■■■ ■CHAPTER 24 Website Security Advanced ASP.NET Component-Based Programming 903 Custom Controls 937 Caching and Performance Tuning 985 Web Parts 1029 ■INDEX 1063 v MacDonald.book Page vi Friday, December 30, 2005 12:59 PM MacDonald.book Page vii Friday, December 30, 2005 12:59 PM Contents About the Author xxvi About the Technical Reviewer xxvii Acknowledgments xxviii Introduction xxix PART ■CHAPTER ■■■ Introducing NET Introducing the NET Framework The Evolution of Web Development HTML and HTML Forms Server-Side Programming Client-Side Programming The Problems with ASP The NET Framework 10 C#, VB NET, and the NET Languages 12 The Intermediate Language 12 Other NET Languages 14 The Common Language Runtime 14 The NET Class Library 16 Visual Studio 17 NET 2.0 18 C# 2.0 18 ASP.NET 2.0 19 Visual Studio 2005 20 The Last Word 21 vii MacDonald.book Page viii Friday, December 30, 2005 12:59 PM viii ■C O N T E N T S ■CHAPTER ■CHAPTER Learning the C# Language 23 The NET Languages C# Language Basics Case Sensitivity Commenting Line Termination Block Structures Variables and Data Types Assignment and Initializers Strings and Escaped Characters Arrays Enumerations Variable Operations Advanced Math Type Conversions Object-Based Manipulation The String Class The DateTime and TimeSpan Classes The Array Class Conditional Structures The if Block The switch Block Loop Structures The for Block The foreach Block The while Block Methods Parameters Method Overloading Delegates The Last Word 23 24 24 25 26 26 27 29 30 31 33 35 36 36 39 40 42 44 44 45 46 47 48 49 50 51 53 53 54 57 Types, Objects, and Namespaces 59 The Basics About Classes 59 Static Members 61 A Simple Class 62 MacDonald.book Page ix Friday, December 30, 2005 12:59 PM ■C O N T E N T S ■CHAPTER Building a Basic Class Creating a Live Object Adding Properties Adding a Basic Method Adding a Constructor Adding a Basic Event Testing the Product Class Value Types and Reference Types Assignment Operations Equality Testing Passing Parameters by Reference and by Value Reviewing NET Types Understanding Namespaces and Assemblies Using Namespaces Importing Namespaces Assemblies Advanced Class Programming Inheritance Static Members Casting Objects Partial Classes Generics The Last Word 62 63 65 66 67 68 70 73 73 74 74 76 78 79 80 81 82 83 84 85 87 89 90 Introducing Visual Studio 2005 91 The Promise of Visual Studio 91 Creating a Website 93 The Solution Explorer 96 Designing a Web Page 98 Adding Web Controls 99 The Properties Window 101 Adding Ordinary HTML 102 HTML Tables 104 Writing Code 105 Adding Event Handlers 106 IntelliSense and Outlining 107 Assembly References 114 ix MacDonaldIndex.fm Page 1082 Friday, December 30, 2005 12:28 PM 1082 ■I N D E X data binding (continued) improving database performance 988 repeated-value data binding 547–548 data source caching 995 single-value data binding 540–541 data source controls 564–565 example 542–544 concurrency checking 577–578 types in ASP.NET 540 handling errors 574 workings 540, 541 other types of parameters 572–573 XmlTextReader class 672 Page lifecycle 565 data caching 994, 1004 parameterized commands 570–572 Application state compared 994 selecting records 568–569 data source controls 1012–1016 SqlDataSource class 566–567 ObjectDataSource 1016 updating records 574–576 SqlDataSource 1013–1015 workings 569–570 inserting an object into cache 1005 replacing state management 985 Data Source value ConnectionString property 495 simple cache test 1006–1010 data table, updating 529 web services 1010–1012 data type conversions data layer, three-tier design 905 data management, ADO.NET 471–478 data namespaces 489 data objects 907 description 848 Data property XmlDataSource class 697, 698 C# strictness 142 web services 831 data types See also variables and datatypes and NET languages 27 class library 28 common data types 28 data provider factories 566 reference types 73 data provider objects 490–491 value types 73 data providers variable prefixes 30 ADO.NET 487 class derivation 488 description 488 web services 847–848 communication limitations 826 DataAdapter class differences 491 CommandBuilder object 528 different operations 491 data binding with databases 557 from code to data source 488 data provider objects 491 naming conventions 491 methods new features in ASP.NET 2.0 20 DeleteCommand method 529 SQL Server data provider 487, 491 Fill method 521, 533 translating code between 491 FillSchema method 533 data retrieval 500, 501 automatic postback 505 example 502–506 InsertCommand method 529 Update method 529 modifying disconnected data 526 MacDonaldIndex.fm Page 1083 Friday, December 30, 2005 12:28 PM ■I N D E X properties 520 obtaining sample database 476 RowUpdated event 533 relational databases 472 selecting disconnected data 519 stored procedures 919 updating disconnected data 528 System.Data namespace 78 database access ADO.NET 987, 988 transactions in web services 888–891 DataBind method connection strings 496, 497 Control class 541 output caching 996 GridView control 582 database components 919 advantages 919 aggregate functions 928–929 consuming 924–928 error handling 927 example 920, 923 database connection string adding special variable 168 database connections ADO.NET classes 487 ConnectionString property 495 making a connection 497–500 number of connections 493 problems of state 474 SQL Server authentication 496 try catch block 493 verifying connection 497 Windows authentication 495 database profiling 987 databases accessing data 471 browsing and modifying in Visual Studio 476–478 common errors 219 Page class 541 single-value data binding 541 timing of calling method 545 DataBind() method ListBox control 549 DataBinder class Eval method 594, 609 System.Web.UI namespace 609 DataField property BoundField class 586 DataFile property XmlDataSource class 697 DataFormatString property BoundField class 586, 588 GridView control 588 DataItem property GridViewRow control 593, 594 MenuItem control 424 DataKeyNames property GridView control 598 DataMember property Control class 558 TreeView control 696 DataReader class components 919 Close method 502 connections 920 data binding with databases 557 deployment configuration 455 data provider objects 491 encapsulation 919 data retrieval example 503–505 file access 625 defining 501 internet access 473–474 Read method 501 isolation from web page 907 retrieving data 500 1083 MacDonaldIndex.fm Page 1084 Friday, December 30, 2005 12:28 PM 1084 ■I N D E X DataReader class (continued) using with Command object 501 DataReader value SqlDataSourceMode enumeration 569 DataRelation class adding objects to DataSet 524 instantiating 523 restrictions 526 DataRow class XML in ADO.NET 698 DataSet property XmlDataDocument class 699 DataSet value SqlDataSourceMode enumeration 569 DataSource property GridView control 582 DataSourceID property GridView class 583 Delete method 527 ListBox control 569 Rows collection 521 Menu control 420 DataRowState enumeration DataSet, storing row state 529 DataSet class DataSourceMode property SqlDataSource class 569 DataTable class adding DataRelation objects 524 caching 1016 Clone method 73 filtering cached DataSet 1009 concurrency 533 web service data types 847 Copy method 1009 DataValueField property data as XML 656 list controls 555 data binding 558 SelectedItem class 556 data binding with databases 557 data caching 994 data caching in web service 1010 database access 475 database component example 920 filtering cached DataSet 1008 DataView control RowFilter property 1015 Sort property 604 Date data types format strings 590 Date property GetChanges method 530 CalendarDay class 295 introduction to ADO.NET 474 DateTime class 43 modifying disconnected data 526 DateTime structure 28, 42, 43 package for data 487 AddDays method 61 ReadXmlSchema method 702 creating a profile 797 Remove method 527 Hour property 61 retrieving data 500 members 43 selecting disconnected data 519 nature and behavior of data type 77 storing row state 529 Now property 61 updating database 475 ToString() method 590 using disconnected data 518 web service data types 847 working with related tables 538 Day property DateTime class 43 MacDonaldIndex.fm Page 1085 Friday, December 30, 2005 12:28 PM ■I N D E X DayHeaderStyle property Calendar control class styles 293 DayNameFormat property Calendar control class 298 DayOfWeek property DateTime class 43 DayRender event Calendar class 959 Calendar control 295, 299 CalendarDay class 296 Days property TimeSpan class 43 DaysInMonth method DateTime class 43 DayStyle style property Calendar control class styles 293 DBUtil class 931, 932 DefaultMode property DetailsView class 934 defaultValue attribute tag 794 control design time support 970 definitions element WSDL document 818 delegates 54–56 description 76 events 55 Delete method DataRow class 527 Directory class 627 DirectoryInfo class 633 File class 628 FileInfo class 633 Delete statement 487 DCOM 815 data deletion example 516–518 debug attribute executing 507 tag 454 debugging commands in break mode 118 components using Visual Studio 928 disabling caching while testing 996 tracing 252 debugging with Visual Studio 17, 92, 115, 253 single-step debugging 116–118 Decimal class 28 nature and behavior 77 numeric format string 589 DeclarativeCatalogPart class 1048 using 1050, 1051 default.aspx default login page 718 DefaultButton property HtmlForm class 186 Panel control 186 DefaultCredentials property CredentialCache class 880 SQL basic concepts 479 DeleteCommand property DataAdapter class 520, 529 SqlDataSource class 568, 575, 602 DeleteCommandType property SqlDataSource class 568 Deleted event data source controls 566 SqlDataSource class 574 DeleteInactiveProfiles method ProfileManager class 805 DeleteMethod method ObjectDataSource class 931 DeleteProfile method ProfileManager class 805 DeleteProfiles method ProfileManager class 805 DeleteRole method Roles class 776 1085 MacDonaldIndex.fm Page 1086 Friday, December 30, 2005 12:28 PM 1086 ■I N D E X DeleteUser method Membership class 754 deleting data modifying disconnected data 526 Deleting event data source controls 566 deny rule tag 722 web.config settings 732 dependencies design time support 969–970 events and postbacks 973–977 maintaining state information 967–969 using a derived control 955–956 Description attribute control design time support 970 description attribute configuring membership provider 747 description element types element 818–819 Cache object support for 1005 Design mode 1032 caching 1016–1027 design time support dependencies parameter attributes 970 Insert method, Cache object 1005 deploying a simple site 453–454 custom controls 970 design view ASPNET account 456–458 switching to code view 105 code compilation 459–460 DestinationPageUrl property configuration steps 455 web applications and components 454 deployment 427 Login control 762, 765 DetailsView class AutoGenerateDeleteButton property 576 database configuration 455 AutoGenerateEditButton property 576 IIS security settings 455 AutoGenerateInsertButton property 576 registering components 128 AutoGenerateRows method 571 Visual Studio 92 DefaultMode property 934 Windows account permissions 455 defining 933 XCopy deployment 455 deployment with Visual Studio 2005 460 copying a new website 463–465 creating a virtual directory for a new project 460–463 publishing a new website 466–467 derived controls 953 changing control rendering 961, 963 composite controls, creating 971–973 creating a custom control library 957, 958 creating simple derived control 953, 955 creating Web Control 964–969 custom controls and default values 958, 959, 960 DetailsView control 581, 618 defining fields 619–621 introduction 618 repeated-value data binding 548 Dictionary collection data binding 553–555 System.Collections.Generic namespace 554 Digest mode Windows authentication methods 731 digital certificates SSL workings 716 direct data access 492 introduction 492 MacDonaldIndex.fm Page 1087 Friday, December 30, 2005 12:28 PM ■I N D E X directories modifying 526–527 authorizating access to 720 multiple tables 521–526 creating virtual directories 441 selecting data 519–520 getting 160 updating 528 directory authentication methods 731 Directory class methods 627 intuitive nature of 629 System.IO namespace 626 Directory property FileInfo class 634 directory security settings 730 Directory Security tab virtual directories 451 DirectoryInfo class creating 634 GetDirectories method 636 GetFiles method 636 discovery files TerraService web service 892 Display property BaseValidator class 270 RangeValidator control 274 DisplayMode property BulletedList control 190 ValidationSummary control 274 DisplayRememberMe property Login control 765 DisplaySideBar property Wizard control 310 Dispose method Connection class 499–500 methods 633–634 DISTINCT keyword 484 Name property 639 distributed technologies properties 633–634 System.IO namespace 626, 633 DirectoryName property FileInfo class 634 DirectorySecurity class System.Security.AccessControl namespace 628 disabled accounts 758–759 Disabled property HtmlControl class 156 DISCO Web Service Discovery 827 web service standards 817 disconnected access 317 ADO.NET characteristics 474–475 updating data issues 475 disconnected data adding information to DataSet 527 DataSet class 518 NET Framework characteristics 17 tag 141, 206, 366, 369 grouping 132 inserting formatted text 139 related control classes 177 style attribute 131, 941 DivideByZeroException class 219, 223, 225, 229, 865 catching 233 throwing exceptions 232 division operator (/) 35 DNS (Domain Name Service) DNS registry 430 getting name161 networks 430 Document object configuring in Visual Studio 101 document tab virtual directories 446 1087 MacDonaldIndex.fm Page 1088 Friday, December 30, 2005 12:28 PM 1088 ■I N D E X documentation tags WSDL document 839 domain names DNS (Domain Name Service) 430 IP addresses 429 domain parameter WSDL.exe parameters 858 Dotted value BorderStyle enumeration 180 Double class 28 nature and behavior 77 Double value BorderStyle enumeration 180 drawing space GDI+ 978 DrawXyz methods Graphics class 978 DriveFormat method DriveInfo class 635 DriveInfo class methods 635 System.IO namespace 626 DriveType method DriveInfo class 635 DropDownList control 186–187 repeated-value data binding 548 tag underlying 177 Duration attribute OutputCache directive 996 dynamic graphics DynamicHoverStyle property Menu control 422 DynamicMenuItemStyle property Menu control 422 DynamicMenuItemTemplate property Menu control 423 DynamicMenuStyle property Menu control 422 DynamicSelectedStyle property Menu control 422 ■E e-card applet 206–212 generating automatically 214–215 improving 212–214 E-commerce sites data driven ASP.NET applications 473 EditItemIndex property GridView control 613 EditItemTemplate class 610 Editor mode 1032 EditorZone class 1031 editing appearance and behavior of Web Parts 1054 editing controls held in 1045 EditRowStyle property GridView control 590 elements specifying XML namespace 682 Xml documents 676 ellipse basic drawing 978–980 drawing an ellipse with Graphics class 978 drawing custom text 980–981 filling an ellipse with Graphics class 979 GDI+ 977, 982 placing images inside web pages 981–983 dynamic web pages ISAPI and ASP.NET dynamically generated table example 193–194 email address regular expression 281 EmptyDataRowStyle property GridView control 591 EmptyDataTemplate class 611 EmptyZoneTextStyle property WebPartZoneBase class 1038 MacDonaldIndex.fm Page 1089 Friday, December 30, 2005 12:28 PM ■I N D E X EnableCaching property SqlDataSource class 569 EnableCaching value CacheItemRemovedReason enumeration 1013 EnableClientScript property manual validation 276 RangeValidator control 273 EnableClientSideScript property BaseValidator class 271 Enabled attribute tracing 264 Enabled property BaseValidator class 271 impersonation 737 security cookies 718 SSL 715 workings 716 view state 320 enctype attribute tag 651 end of line character See line-termination character EndRequest event Application class 356, 357 EndsWith() method String class 41 enumerations 33, 34 WebControl class 180 brief description 944 WebPart class 1053 description 76 enablePasswordReset attribute configuring membership provider 748 enablePasswordRetrieval attribute configuring membership provider 748 EnableSession property WebMethod attribute 869 EnableView state disabling view state 986 EnableViewstate properties data binding and view state 553 EnableViewState property HtmlControl class 156 introduction 182 values 182 web service data types 847 equal to operator (==) 45 equality testing 74 String class 77 error checking data binding 547 Visual Studio 92 error detection Visual Studio NET 17 error handling 219 Label control 272 NET 220 Page class 159 database component 927 repeater control 967, 968 WebControl class 180 enableViewStateMac attribute element 321 encapsulation 907 database components 919 example 923 encryption forms authentication 726 error modes 248 modifying web.config file 249 error pages 220, 246, 248 custom error pages 249–252 structured exception handling 231 tag 251 error underlining IntelliSense 110, 111 ErrorCode enumeration 34 1089 MacDonaldIndex.fm Page 1090 Friday, December 30, 2005 12:28 PM 1090 ■I N D E X ErrorMessage property EventLog class BaseValidator class 270 creating custom logs 241–243 manual validation 277 retrieving log information 243 errors behaviors 250 System.Diagnostics namespace 239 events CLR and 15 application events 357 common errors 219–220 AutoPostBack property 199, 214 custom exception classes 234–236 building a basic class 68 type conversion 37 CtrlChanged() subroutine 206 Errors Total counter performance counters 993 escape character (\) C# and VB.NET 30 Eval() method custom control events and postbacks 973–977 delegates 55 event tracker application 203 EventArgs object 154 DataBinder class 594, 609 HTML server controls 134, 153 SiteMapPath control 411 HtmlInputImage control 154–156 event handling 142, 143 introduction to classes 60 adding handlers in Properties window 106 Page.Load event 147 adding handlers in Visual Studio 106, 107 runat="server" attribute 146 AdRotator control 302 user control events 946–949 building a basic class 69, 70 using events with parameters 949–951 code-behind class 141 web controls 199 HtmlInputButton class 139 web forms 139 multiple events 999 subclassing controls 959 TablePage class 195, 196 validator controls 284 event logging XmlDocument class 679 Exceps Thrown counter performance counters 993 Exception class catching exceptions inherited from 227 potential problems 238 classes that inherit from 223 tips 242, 246 InnerException property 224 event logs See logging events properties 222 Event Viewer utility 237, 241 System namespace 222 EventArgs object throwing exceptions 233 passing additional information 154 using 949 EventHandler delegate System namespace 947 EventLog Class security 240 exception handling catch statements 226–227 DivideByZero exception 225 example 229–231 exception chains 224 Exception class 222 MacDonaldIndex.fm Page 1091 Friday, December 30, 2005 12:28 PM ■I N D E X exception classes represent tyes of errors 223 extensibility and Visual Studio 92 Extension property key features 221–222 DirectoryInfo class 633 logging exceptions 236–238 FileInfo class 633 nested exception handlers 227–229 null reference exception 229 overlapping handlers 228 structured exception handling 221–222 key points 231 Try Catch Finally block 225–226 troubleshooting 223 Exception property SqlDataSourceStatusEventArgs class 574 exception types 222 ExceptionHandled property SqlDataSourceStatusEventArgs class 574 exceptions catching same class exceptions 227 custom exception classes 234–236 throwing exceptions 232–234 Try Catch Finally block 227 execute permission Virtual Directory Creation Wizard 446 ExecuteNonQuery method Command class 507, 516 ExecuteReader method Command class 501 Exists method Directory class 627 File class 628 Exists property DirectoryInfo class 633 FileInfo class 633 ExpandDepth property TreeView control 414 ExpandImageUrl property TreeView control 414 Exponential data type numeric format string 589 ■F FailureStyle property Login control 762 FailureText property Login control 762, 764 fields, declaring 62 Fields dialog box 592 file access cookies 642 databases 625 guest book example 645–650 simple file access 626 static methods or instance classes 627 web applications 625, 626 file browser creating 636–640 File class CreateText method 640 GetAttributes method 632 methods 628, 644 intuitive nature of 629 Open method 641 OpenText method 640, 641 OpenWrite method 642 state 916 System.IO namespace 626 file mappings changing web.config file 165 registering 436, 437 virtual directories 448, 449, 450 file references 913 file types restricted file types 708 file types, ASP 128 1091 MacDonaldIndex.fm Page 1092 Friday, December 30, 2005 12:28 PM 1092 ■I N D E X file types, ASP.NET 127 ascx files 127 asmx files 127 aspx files 127 global.asax file 127 web.config files 127 file uploads 650 maximum size 653 FileAttributes enumeration creating a file list 632 FileInfo class creating 634 creating a file list 632 methods 633–634 FillXyz methods Graphics class 979 FindControl method CreateUserWizard control 769 Page class 277 FindInactiveProfilesByUserName method ProfileManager class 806 FindProfilesByUserName method ProfileManager class 806 FindSiteMapNode method SiteMapProvider class 406 FindUsersByEmail method Membership class 754 FindUsersByName method Name property 639 Membership class 754 properties 633–634 FindUsersInRole method state 916 System.IO namespace 626, 633 Roles class 776 FinishButtonClick event FileNotFoundException class 224 CreateUserWizard control 768 files Wizard control 314 authorizating access to 721 creating a file list 630 reading and writing binary files 642 reading and writing flat files 640–642 retrieving file size 629 retrieving information about 626 FinishPreviousButtonStyle property Wizard control 316 FirstBulletNumber property BulletedList control 190 FirstChild property XmlNode class 678 shortcuts for reading and writing files 643–645 FirstDayOfWeek property using files with web applications 625 FirstName property FileStream class saving images to valid stream 980 FileUpload control input type=file tag 650 PostedFile class 651 Fill method DataAdapter class 533 selecting disconnected data 521 FillSchema method DataAdapter class 533 Calendar control 292, 298 Profile class 795 flat files reading and writing streams 640 Flush method StreamWriter class 640 focus control losing focus 963 Focus()method web control classes 185 MacDonaldIndex.fm Page 1093 Friday, December 30, 2005 12:28 PM ■I N D E X folders with a globe icon 443 Font property forms authentication 716 ASP.NET model 717 FontInfo class 183 attributes/settings 718 WebControl class 180 authorization rules 719 FontInfo class properties 183 access for specific users 722 access to specific directories 720 fonts, drawing custom images 981 accessing specific files 721 FontUnit type 184 setting up with WAT 722–725 Footer class code for integrated user control 944–946 footer user controls non interactive controls 941 footers user control footers 940 FooterStyle property custom cookies 716 impersonation 735 login page 726–729 restricting anonymous users 719 steps to implement 718 web services 878, 882 web.config settings 718 BoundField class 586 forms collection GridView control 591 tracing 258 FooterTemplate class 610 FooterText property BoundField class 586 tag web.config settings 718 FormsAuthentication class for block 48 login page 726 foreach block 49, 50 methods and properties 726 ForeColor property RedirectFromLoginPage method 727 BaseValidator class 270 TextBox class 177, 952 TitleStyle class 1040 ValidationSummary control 274 WebControl class 180 WebPart class 1053 Form class IsValid property 273, 276 tag 5, 131, 138 ASP.NET controls 136 enctype attribute 651 System.Web.Security namespace 726 FormsCookieName property FormsAuthentication class 726 FormsCookiePath property FormsAuthentication class 726 FormsView class defining 933 FormView control 581, 618 introduction 621–622 repeated-value data binding 548 fragment caching 995 HtmlForm class 138 caching generic portion of page 997 processing as a server control 135 OutputCache directive 1002 forms cookie security 337 frame targets AdRotator class 301 1093 MacDonaldIndex.fm Page 1094 Friday, December 30, 2005 12:28 PM 1094 ■I N D E X frames compared to master pages 360 Friend keyword description 63 From clause Select statement 482 FromImage method Graphics class 978 Fromxyz methods TimeSpan structure 43 FTP directory reviewing contents 629 FullName property DirectoryInfo class 633 FileInfo class 633 functions methods using functions 923 parameter signatures 53 web service visibility 850 FundTransfer method AccountUtility class 918 ■G GAC (Global Assembly Cache) shared assemblies 454 garbage collection 14 GDI+ 977 advanced features 980 Bitmap class 978 drawing custom images 981 drawing custom text 980–981 drawing space 978 dynamic graphics 977, 982 graphics context 978 General data type format string 590 GeneratePassword method Membership class 754 generic collections repeated-value data binding 550–551 generics 89–90 GenericWebPart class using server controls and user controls as Web Parts 1034 GeoTrust certificate authority 713 get accessor 65 GetAccessControl method Directory class 628 File class 628 GetAllInactiveProfiles method ProfileManager class 805 GetAllProfiles method ProfileManager class 805 GetAllRoles method Roles class 776 GetAllUsers method Membership class 754 GetAttributes method File class 628, 632 GetAuthCookie method FormsAuthentication class 726 GetBaseException method Exception class 222 GetCategories method database component example 920 ObjectDataSource class 931 GetChanges method DataSet class updating a data table 530 GetCreationTime method Directory class 627 File class 628 GetCurrentDirectory method Directory class 628 GetDirectories method Directory class 627 DirectoryInfo class 634, 636 GetDrives method DriveInfo class 635 MacDonaldIndex.fm Page 1095 Friday, December 30, 2005 12:28 PM ■I N D E X GetElementById method XmlDocument class 680 GetElementsByTagName method XmlDocument class 680 GetFileName method Path class 653 GetFiles method Directory class 627, 632 DirectoryInfo class 634, 636 GetInfo method creating components 915 GetItems method database component example 920 ObjectDataSource class 932 overloading in database component example 923 GetLastAccessTime method Directory class 627 File class 628 GetLastWriteTime method Directory class 627 File class 628 GetLogicalDrives method Directory class 627 GetLowerBound() method Array class 44 GetNames() method Enum class 213 GetNumberOfInactiveProfiles method ProfileManager class 805 GetNumberOfProfiles method ProfileManager class 805 GetNumberOfUsersOnline method Membership class 754 GetParent method Directory class 627 GetPassword method MembershipUser class 755 GetPlaceFacts method TerraService web service 895 GetPlaceList method TerraService web service 895 Windows clients 899 GetPostBackEventReference method IPostBackEventHandler interface 974 Page class 973 GetProfile method Profile class 808 GetPropertyValue method ProfileBase class 794 GetRedirectUrl method FormsAuthentication class 726 GetRolesForUser method Roles class 776 GetTagsByElementName method XmlDocument class 701 GetTile method TerraService web service 898 GetTileMetaFromLonLatPt method TerraService web service 898 GetUpperBound method Array class 44 GetUser method Membership class 754 GetUserNameByEmail method Membership class 754 GetUsersInRole method Roles class 776 global.asa file description 128 global.asax file 356, 357 description 127 GlobalSign certificate authority 713 graphics embedding dynamic graphics 982 Graphics class drawing methods 978 1095 MacDonaldIndex.fm Page 1096 Friday, December 30, 2005 12:28 PM 1096 ■I N D E X DrawXyz methods 978 generating columns with Visual Studio 587–588 FillXyz methods 979 handling events in templates 612–613 FromImage method 978 multiple templates 610 System.Drawing namespace and GDI+ 978 paging 603, 606–607 working with pixels 979 repeated-value data binding 548 Graphics class (continued) graphics context selecting rows 595 adding select button 596 Brush object 979 GDI+ 978 sorting 603–606 Pen object 979 styles 590–592 greater than operator (>) 45 templates 608–609 greater than or equal to operator (>=) 45 using a data field as select button 597–598 greeting card applet 206–212 using selection to create master-details form 598–599 generating automatically 214–215 improving 212–214 grid layout feature Visual Studio 100 GridLines property GridView control 588 GridView class DataSourceID property 583 GridView control 581 Auto Format feature 647 AutoGenerateColumns property 806 GridViewRow control Cells collection 593 DataItem property 593, 594 GridViewRowEventArgs class Row property 594 Groove value BorderStyle enumeration 180 element organizing profile properties 798–799 Group profile property attribute tag 794 automatically generating columns 582–583 groups, profiles 798–799 configuring columns 586 guest book configuring styles with Visual Studio 592–593 defining columns 584–585 editing templates in Visual Studio 611–612 editing with 600–602 editing with templates 613–615 validation 615 without Command column 616–617 file access example 645 formatting 588 fields 588–590 specific values 593–594 file access example 645–650 Guest role default Windows roles 734 GUID (globally unique identifier) using files with web applications 625 ■H HashPasswordForStoringInConfigFile method FormsAuthentication class 726 Hashtable collection System.Collections namespace 553 ... about NET programming, including Pro ASP. NET 2. 0 in C# 20 05 (Apress, 20 05), Microsoft NET Distributed Applications (Microsoft Press, 20 03), Programming NET Web Services (O’Reilly, 20 02 ) , and ASP. NET: ...MacDonald.book Page i Friday, December 30, 20 05 12: 59 PM Beginning ASP. NET 2. 0 in C# 20 05 From Novice to Professional ■■■ Matthew MacDonald MacDonald.book Page ii Friday, December 30, 20 05 12: 59... 12: 59 PM Beginning ASP. NET 2. 0 in C# 20 05: From Novice to Professional Copyright © 20 06 by Matthew MacDonald All rights reserved No part of this work may be reproduced or transmitted in any form

Ngày đăng: 25/03/2019, 15:59

Mục lục

  • Beginning ASP.NET 2.0 in C# 2005: From Novice to Professional

    • Table of Content

    • PART 1 Introducing .NET

      • Chapter 1 Introducing the .NET Framework

      • Chapter 2 Learning the C# Language.

      • Chapter 3 Types, Objects, and Namespaces

      • Chapter 4 Introducing Visual Studio 2005.

      • PART 2 Developing ASP.NET Applications

        • Chapter 5 Web Form Fundamentals

        • Chapter 6 Web Controls

        • Chapter 7 Tracing, Logging, and Error Handling.

        • Chapter 8 Validation and Rich Controls

        • Chapter 9 State Management.

        • Chapter 10 Master Pages and Themes

        • Chapter 11 Website Navigation

        • Chapter 12 Deploying ASP.NET Applications

        • PART 3 Working with Data

          • Chapter 13 ADO.NET Fundamentals

          • Chapter 14 Data Binding.

          • Chapter 15 The Data Controls

          • Chapter 16 Files and Streams.

          • Chapter 17 XML

          • PART 4 Website Security

            • Chapter 18 Security Fundamentals

            • Chapter 19 Membership

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

Tài liệu liên quan