您的位置:首页 > Web前端

Beginning ASP.NET 3.5 in C# 2008 From Novice to Professional Second Edition(ASP.NET 3.5(C#2008)入门 )翻译

2008-10-29 00:09 751 查看


为了学习而不得已翻译,放到网上自己看着方便,一来可以作为笔记,另外可以得到高手的指正、指点。今天先翻译自己感兴趣的第十章。

先发个目录,以后慢慢翻译。

目录
作者简介 . xxv
About the Technical Reviewer
关于技术评论. xxvii
Acknowledgments
鸣谢. . xxix
Introduction
导言. . xxxi
第一部分 n n n 介绍 .NET
nCHAPTER 1 The .NET 框架. . 3
The Evolution of Web Development
Web的开发演变3
HTML and HTML Forms
HTML和HTML表单. . 3
Server-Side Programming
服务器端编程6
Client-Side Programming
客户端编程. 7
The .NET Framework
.NET框架9
C#, VB, and the .NET Languages11
The Common Language Runtime
公共语言运行库. . 14
The .NET Class Library
.NET类库. . 16
Visual Studio . . 16
The Last Word . . 17
nCHAPTER 2 The C# 语言. . 19
The .NET Languages19
C# Language Basics 20
Case Sensitivity
大小写敏感性. . 20
Commenting
注释. . 21
Statement Termination
声明终止. . 21
Blocks
块. 22
Variables and Data Types
变量和数据类型. . 22
Assignment and Initializers
赋值和初始化. 24
Strings and Escaped Characters
字符串和转义字符26
Arrays
数组. . 26
Enumerations
枚举. 29
Variable Operations
变量操作符. 30
Advanced Math
高级数学操作符. . 31
Type Conversions
类型转换. 32
Object-Based Manipulation
基于对象的操纵34
The String Type
字符串类型. . 34
The DateTime and TimeSpan Types
日期时间类型和时间区段类型36
The Array Type
数组类型39
Conditional Logic
有条件的逻辑40
The if Statement
If语句. . 41
The switch Statement
switch语句41
Loops
循环. 42
The for Loop
For循环. . 43
The foreach Loop
foreach循环. 44
The while loop
while循环45
Methods
方法. 46
Parameters
参数47
Method Overloading
重载方法. 48
Delegates
委托. 49
The Last Word . . 51
nCHAPTER 3 Types, Objects, and Namespaces
类型,对象和命名空间. . 53
The Basics About Classes
类的基础. 53
Static Members
静态成员. . 55
A Simple Class
一个简单的类55
Building a Basic Class
建立一个基本的类. 56
Creating an Object
创建一个对象57
Adding Properties
添加属性58
Adding a Method
添加方法. 61
Adding a Constructor
添加构造. 61
Adding an Event
添加事件. . 62
Testing the Product Class
测试Product类64
Value Types and Reference Types
值类型和引用类型66
Assignment Operations
分配操作符. . 67
Equality Testing
相等测试. . 67
Passing Parameters by Reference and by Value
使用引用和值传递参数. 68
Reviewing .NET Types
审阅.NET类型69
Understanding Namespaces and Assemblies
了解命名空间和组件71
Using Namespaces
使用命名空间. . 72
Importing Namespaces
导入命名空间. . 73
Assemblies 74
Advanced Class Programming
高级类编程75
Inheritance
继承75
Static Members
静态成员. . 76
Casting Objects
铸造对象. . 77
Partial Classes
Partial 类80
Generics
泛型. . 81
The Last Word . . 82
PART 2 n n n开发ASP.NET 应用程序
nCHAPTER 4 Visual Studio 87
The Promise of Visual Studio. . 87
Creating Websites
创建网站. . 88
Creating a New Web Application
创建一个新的Web应用程序89
Websites and Web Projects
网站和Web项目. 91
The Hidden Solution Files92
The Solution Explorer 93
Adding Web Forms
添加Web窗体. . 94
Migrating a Website from a Previous Version of Visual Studio
从以前版本的Visual Studio移植网站的 96
Designing a Web Page . 97
Adding Web Controls. 98
The Properties Window. 100
The Anatomy of a Web Form. 102
The Web Form Markup . 102
The Page Directive. . 103
The Doctype . 104
The Essentials of XHTML . . 106
Writing Code112
The Code-Behind Class 112
Adding Event Handlers . 113
IntelliSense and Outlining. . 115
Visual Studio Debugging . 120
The Visual Studio Web Server . 121
Single-Step Debugging. 122
Variable Watches 126
The Last Word . 127
nCHAPTER 5 Web Form Fundamentals . 129
The Anatomy of an ASP.NET Application129
ASP.NET File Types . 130
ASP.NET Application Directories . . 131
Introducing Server Controls . . 132
HTML Server Controls . . 133
Converting an HTML Page to an ASP.NET Page . 134
View State 137
The HTML Control Classes . 138
Adding the Currency Converter Code . 140
Event Handling . . 142
Behind the Scenes with the Currency Converter 144
Error Handling146
Improving the Currency Converter . . 147
Adding Multiple Currencies 147
Storing Information in the List . 148
Adding Linked Images. . 150
Setting Styles 152
A Deeper Look at HTML Control Classes153
HTML Control Events153
Advanced Events with the HtmlInputImage Control. 154
The HtmlControl Base Class156
The HtmlContainerControl Class . . 157
The HtmlInputControl Class 157
The Page Class 158
Sending the User to a New Page . 159
HTML Encoding . 160
Application Events . 161
The Global.asax File 162
Additional Application Events. . 163
ASP.NET Configuration 163
The web.config File . 164
Nested Configuration165
Storing Custom Settings in the web.config File . 166
The Website Administration Tool (WAT). . 168
The Last Word . 170
nCHAPTER 6 Web Controls . . 171
Stepping Up to Web Controls. 171
Basic Web Control Classes. 172
The Web Control Tags. . 173
Web Control Classes . . 174
The WebControl Base Class 175
Units . . 176
Enumerations 177
Colors. 178
Fonts . 179
Focus . 181
The Default Button. . 181
List Controls 182
Multiple-Select List Controls . . 183
The BulletedList Control 185
Table Controls . 186
Web Control Events and AutoPostBack . 191
How Postback Events Work 195
The Page Life Cycle. 196
A Simple Web Page199
Improving the Greeting Card Generator . . 204
Generating the Cards Automatically . . 206
The Last Word . 209
nCHAPTER 7 State Management. . 211
The Problem of State . 211
View State. . 212
The ViewState Collection . . 212
A View State Example . . 213
Making View State Secure . 214
Retaining Member Variables . . 215
Storing Custom Objects 217
Transferring Information Between Pages . . 218
Cross-Page Posting . 219
The Query String 224
Cookies . 228
A Cookie Example . . 230
Session State . . 231
Session Tracking 231
Using Session State. 232
A Session State Example . . 233
Session State Configuration. . 236
Cookieless237
Timeout . . 240
Mode . 241
Application State . . 245
An Overview of State Management Choices247
The Last Word . 248
nCHAPTER 8 Error Handling, Logging, and Tracing . . 249
Common Errors 249
Exception Handling 251
The Exception Class 252
The Exception Chain 253
Handling Exceptions . . 254
Catching Specific Exceptions. . 255
Nested Exception Handlers 257
Exception Handling in Action . . 258
Mastering Exceptions . . 260
Throwing Your Own Exceptions . 260
Logging Exceptions 264
Viewing the Windows Event Logs . 265
Writing to the Event Log 268
Custom Logs. 270
A Custom Logging Class271
Retrieving Log Information . 273
Error Pages. 275
Error Modes . 277
Custom Error Pages. 278
Page Tracing . . 280
Enabling Tracing 280
Tracing Information . 281
Writing Trace Information. . 287
Application-Level Tracing. . 291
The Last Word . 293
nCHAPTER 9 Deploying ASP.NET Applications. . 295
ASP.NET Applications and the Web Server . 295
How Web Servers Work 295
The Virtual Directory 297
Web Application URLs . . 297
Web Farms . . 299
Internet Information Services (IIS) . . 300
The Many Faces of IIS. . 300
Installing IIS 5 (in Windows XP) 301
Installing IIS 6 (in Windows Server 2003) 302
Installing IIS 7 (in Windows Vista) . 304
Installing IIS 7 (in Windows Server 2008) 305
Registering the ASP.NET File Mappings. . 305
Verifying That ASP.NET Is Correctly Installed 306
Managing Websites with IIS Manager . . 308
Creating a Virtual Directory 310
Configuring a Virtual Directory. 312
Deploying a Simple Site . . 316
Web Applications and Components . . 317
Other Configuration Steps . 317
Code Compilation318
The ASP.NET Account . . 319
Deploying with Visual Studio . 323
Creating a Virtual Directory for a New Project . . 324
Copying a Website . . 326
Publishing a Website328
The Last Word . 330
PART 3 n n n Building Better Web Forms
nCHAPTER 10 Validation333
Understanding Validation . 333
The Validator Controls. . 334
Server-Side Validation. . 335
Client-Side Validation . . 335
The Validation Controls336
A Simple Validation Example . . 337
Other Display Options . . 339
Manual Validation . . 341
Validating with Regular Expressions. . 343
A Validated Customer Form 347
Validation Groups352
The Last Word . 354
nCHAPTER 11 Rich Controls . . 355
The Calendar . . 355
Formatting the Calendar357
Restricting Dates 358
The AdRotator . 363
The Advertisement File . 363
The AdRotator Class 364
Pages with Multiple Views 366
The MultiView Control . . 367
The Wizard Control . 372
The Last Word . 379
nCHAPTER 12 User Controls and Graphics . 381
User Controls . . 381
Creating a Simple User Control 382
Independent User Controls. 384
Integrated User Controls387
User Control Events . 389
Passing Information with Events . . 391
Dynamic Graphics . 394
Basic Drawing . . 394
Drawing a Custom Image. . 397
Placing Custom Images Inside Web Pages . . 398
Image Format and Quality . 400
The Last Word . 403
nCHAPTER 13 Styles, Themes, and Master Pages . . 405
Styles405
Style Types . . 406
Creating a Basic Inline Style . . 406
Creating a Style Sheet. . 414
Applying Style Sheet Rules. 417
Themes . 419
How Themes Work . 419
Applying a Simple Theme. . 421
Handling Theme Conflicts . 422
Creating Multiple Skins for the Same Control424
More Advanced Skins . . 425
Master Page Basics427
A Simple Master Page and Content Page 428
How Master Pages and Content Pages Are Connected. 431
A Master Page with Multiple Content Regions . . 433
Default Content . 436
Master Pages and Relative Paths . 437
Advanced Master Pages. . 438
Table-Based Layouts438
Code in a Master Page . 442
Interacting with a Master Page Programmatically . . 442
The Last Word . 444
nCHAPTER 14 Website Navigation . 445
Site Maps . . 445
Defining a Site Map . 446
Seeing a Simple Site Map in Action . . 450
Binding an Ordinary Page to a Site Map . 451
Binding a Master Page to a Site Map . 452
Binding Portions of a Site Map 454
The SiteMap Class. . 459
Mapping URLs . . 461
The SiteMapPath Control . 462
Customizing the SiteMapPath . 463
Using SiteMapPath Styles and Templates 464
Adding Custom Site Map Information. 466
The TreeView Control . 467
TreeView Properties 467
TreeView Styles . 470
The Menu Control . 474
Menu Styles . 476
Menu Templates 477
The Last Word . 480
PART 4 n n n Working with Data
nCHAPTER 15 ADO.NET Fundamentals . . 483
Understanding Data Management . . 483
The Role of the Database . . 483
Database Access in the Web World . . 485
Configuring Your Database . . 486
SQL Server Express . 486
Browsing and Modifying Databases in Visual Studio487
The sqlcmd Command-Line Tool . 489
SQL Basics . 490
Running Queries in Visual Studio . 491
The Select Statement . . 493
The SQL Update Statement 495
The SQL Insert Statement . 497
The SQL Delete Statement . 498
ADO.NET Basics498
Data Namespaces . . 500
The Data Provider Classes . 501
Direct Data Access 503
Creating a Connection. . 504
The Select Command . . 511
The DataReader . 512
Putting It All Together . . 513
Updating Data517
Disconnected Data Access . . 527
Selecting Disconnected Data. . 529
Selecting Multiple Tables . . 531
Defining Relationships . 533
The Last Word . 536
nCHAPTER 16 Data Binding . . 537
Introducing Data Binding . 537
Types of ASP.NET Data Binding . . 538
How Data Binding Works . . 538
Single-Value Data Binding 539
A Simple Data Binding Example . . 539
Simple Data Binding with Properties . 542
Problems with Single-Value Data Binding 543
Using Code Instead of Simple Data Binding . 544
Repeated-Value Data Binding 544
Data Binding with Simple List Controls . . 545
A Simple List Binding Example 546
Strongly Typed Collections. 547
Multiple Binding . 548
Data Binding with a Dictionary Collection 549
Using the DataValueField Property 551
Data Binding with ADO.NET 552
Creating a Record Editor554
Data Source Controls . 559
The Page Life Cycle with Data Binding . . 561
The SqlDataSource . 561
Selecting Records . . 563
Parameterized Commands. 565
Handling Errors. . 570
Updating Records571
The Last Word . 576
nCHAPTER 17 The Data Controls 577
The GridView . . 577
Automatically Generating Columns578
Defining Columns579
Formatting the GridView. . 583
Formatting Fields 584
Using Styles . 585
Formatting-Specific Values 588
Selecting a GridView Row 589
Adding a Select Button . 590
Using Selection to Create Master-Details Pages 591
Editing with the GridView . 593
Sorting and Paging the GridView 596
Sorting 596
Paging 599
Using GridView Templates 601
Using Multiple Templates . . 603
Editing Templates in Visual Studio 604
Handling Events in a Template 605
Editing with a Template 606
The DetailsView and FormView. . 610
The DetailsView . 610
The FormView613
The Last Word . 615
nCHAPTER 18 Files and Streams 617
Files and Web Applications . . 617
File System Information . . 618
The Path Class . . 619
The Directory and File Classes 620
The DirectoryInfo and FileInfo Classes625
The DriveInfo Class . 627
A Sample File Browser . 628
Reading and Writing with Streams. . 632
Text Files . 632
Binary Files . . 635
Shortcuts for Reading and Writing Files. . 636
A Simple Guest Book637
Allowing File Uploads . 642
The FileUpload Control . 643
The Last Word . 646
nCHAPTER 19 XML 647
XML’s Hidden Role in .NET . . 647
Configuration Files. . 647
XHTML 647
ADO.NET Data Access. . 648
Anywhere Miscellaneous Data Is Stored . 648
XML Explained . 648
Improving the List with XML . . 650
XML Basics . . 651
Attributes. 652
Comments653
The XML Classes . . 654
The XML TextWriter. 654
The XML Text Reader . . 657
Working with XML Documents in Memory . . 662
Reading an XML Document 667
Searching an XML Document . 670
XML Validation . 671
XML Namespaces . . 671
XML Schema Definition 673
Validating an XML Document. . 675
XML Display and Transforms 678
The Xml Web Control681
XML Data Binding . 682
Nonhierarchical Binding 683
Hierarchical Binding with the TreeView . . 685
Binding to XML Content from Other Sources 687
The Last Word . 688
PART 5 n n n Website Security
nCHAPTER 20 Security Fundamentals 691
Determining Security Requirements 691
The ASP.NET Security Model. 692
The Visual Studio Web Server . 696
Authentication and Authorization . 696
Forms Authentication . 697
Web.config Settings 699
Authorization Rules . 699
The WAT . 703
The Login Page. . 706
Windows Authentication. . 710
Web.config Settings 711
IIS Settings . . 713
A Windows Authentication Test 716
Impersonation . 717
Understanding Impersonation . 718
Programmatic Impersonation . 718
Confidentiality with SSL . . 719
Creating a Certificate Request. 719
Secure Sockets Layer . . 721
The Last Word . 723
nCHAPTER 21 Membership 725
The Membership Data Store . 725
Membership with SQL Server 2005 Express 727
Using the Full Version of SQL Server . 729
Configuring the Membership Provider 731
Creating Users with the WAT . . 735
The Membership and MembershipUser Classes 737
Authentication with Membership . 741
Disabled Accounts . . 742
The Security Controls . 742
The Login Control743
The CreateUserWizard Control. 748
The PasswordRecovery Control752
Role-Based Security . . 755
Creating and Assigning Roles . 755
Restricting Access Based on Roles758
The LoginView Control . 759
The Last Word . 761
nCHAPTER 22 Profiles . . 763
Understanding Profiles 763
Profile Performance. 764
How Profiles Store Data 765
Using the SqlProfileProvider . 766
Enabling Authentication 767
Using the Full Version of SQL Server . 767
The Profile Databases . . 769
Defining Profile Properties . 770
Using Profile Properties 771
Profile Serialization . 773
Profile Groups 775
Profiles and Custom Data Types . . 775
The Profile API . . 779
Anonymous Profiles. 782
The Last Word . 785
PART 6 n n n Advanced ASP.NET
nCHAPTER 23 Component-Based Programming . 789
Why Use Components?789
Component Jargon 790
Three-Tier Design . . 790
Encapsulation 792
Business Objects 792
Data Objects . 792
Components and Classes . . 793
Creating a Component 793
Classes and Namespaces . 794
Class Members . 796
Adding a Reference to the Component . . 797
Using the Component . . 799
Properties and State . . 801
A Stateful Account Class802
A Stateless AccountUtility Class . . 803
Data-Access Components 804
A Simple Data-Access Component804
Using the Data-Access Component . . 809
Enhancing the Component with Error Handling . 812
Enhancing the Component with Aggregate Information 813
The ObjectDataSource 814
Making Classes the ObjectDataSource Can Understand815
Selecting Records . . 815
Using Method Parameters . 816
Updating Records817
The Last Word . 820
nCHAPTER 24 Caching . . 821
Understanding Caching . . 821
When to Use Caching . . 822
Caching in ASP.NET. 823
Output Caching 824
Caching on the Client Side . 825
Caching and the Query String . 826
Caching with Specific Query String Parameters. 827
A Multiple Caching Example . . 827
Custom Caching Control 829
Fragment Caching . . 830
Cache Profiles831
Data Caching . . 832
Adding Items to the Cache . 832
A Simple Cache Test 833
Caching to Provide Multiple Views 835
Caching with the Data Source Controls . . 839
Caching with Dependencies . 843
File Dependencies . . 843
Cache Item Dependencies . 844
SQL Server 2000 Cache Dependencies . . 844
SQL Server 2005 and 2008 Cache Dependencies. . 849
The Last Word . 853
nCHAPTER 25 ASP.NET AJAX. 855
Understanding Ajax 856
Ajax: The Good . . 856
Ajax: The Bad 856
The ASP.NET AJAX Toolkit. . 857
The ScriptManager . 858
Partial Refreshes . . 859
A Simple UpdatePanel Test 861
Handling Errors. . 864
Conditional Updates. 865
Triggers . . 867
Progress Notification. . 871
Showing a Simulated Progress Bar . . 872
Cancellation . 874
Timed Refreshes . . 876
The ASP.NET AJAX Control Toolkit . . 878
Installing the ASP.NET AJAX Control Toolkit . 878
The Accordion880
The AutoCompleteExtender 884
Getting More Controls . . 887
The Last Word . 888
nINDEX . .
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐