Tuesday, November 30, 2010

C# .Net Web Developer Guide












Contents
Foreword xxi
Chapter 1 Introducing the Microsoft .NET Platform 1
Introduction 2
Introducing the.NET Platform 2
Microsoft .NET and Windows DNA 3
Microsoft .NET Architecture Hierarchy 4
Features of the .NET Platform 5
Multilanguage Development 5
Platform and Processor Independence 7
Automatic Memory Management 7
Versioning Support 8
Support for Open Standards 9
Easy Deployment 9
Distributed Architecture 10
Interoperability with Unmanaged Code 11
Security 12
Performance and Scalability 14
Components of the .NET Architecture 14
.NET Runtime 14
Managed/Unmanaged Code 14
Intermediate Language 15
Common Type System 15
.NET Base Class Library (BCL) 15
Assemblies 16
Metadata 16
Assemblies and Modules 17
Assembly Cache 18
Reflection 19
Just In Time Compilation 19
Garbage Collection 20
Exploring the Code Cycle 21
The Pursuit of Standardization 24
Summary/Solutions Fast Track/Frequently Asked Questions 26
Chapter 2 Introducing C# Programming 33
Introduction 34
Getting Started 35
Creating Your First C# Program 37
Compiling and Executing 38
Defining a Class 40
Declaring the MainMethod 43
Organizing Libraries with Namespaces 43
Using the using Keyword 44
Adding Comments 45
Introducing Data Types 47
Value Types 47
Primitive Data Types 47
Reference Types 48
Explaining Control Structures 49
Using the ifStatement 49
Using the if-elseStatement 50
Using the switch caseStatement 50
Using the forStatement 51
Using the whileStatement 52
Using the do whileStatement 52
Using the breakStatement 52
Using the continueStatement 53
Using the returnStatement 54
Using the gotoStatement 55
Understanding Properties and Indexers 56
Using Properties 56
Get Accessor 59
Set Accessor 59
Accessing Lists with Indexers 60
Using Delegates and Events 69
Delegates 70
Single Cast 74
Multicast 75
Events 79
Using Exception Handling 85
Using the tryBlock 89
Using the catchBlock 89
Using the finallyBlock 89
Using the throwStatement 89
Understanding Inheritance 90
Summary/Solutions Fast Track/Frequently Asked Questions 104
Chapter 3 Visual Studio.NET IDE 109
Introduction 110
Introducing Visual Studio.NET 110
Components of VS.NET 112
Design Window 112
Code Window 113
Server Explorer 114
Toolbox 116
Docking Windows 117
Properties Explorer 117
Solution Explorer 118
Object Browser 119
Dynamic Help 120
Task List Explorer 121
Features of VS.NET 122
IntelliSense 122
XML Editor 124
Documentation Generation (XML Embedded Commenting) 127
Adding XML Document Comments to C# Pages 127
Customizing the IDE 129
Creating a Project 130
Projects 130
Creating a Project 130
Add Reference 131
Build the Project 131
Debugging a Project 132
Summary/Solutions Fast Track/Frequently Asked Questions 133
Chapter 4 Windows Forms 137
Introduction 138
Introducing Windows Forms 138
Writing a Simple Windows Forms Application 141
Adding Controls 142
Adding an Event Handler 145
Adding Controls at Runtime 147
Attaching an Event Handler at Runtime 152
Writing a Simple Text Editor 154
Starting the Project 154
Creating a Menu 155
Adding a New Form 157
Creating a Multiple Document Interface 159
Creating a Dialog Form 160
Using Form Inheritance 162
Adding a TabControl 164
Anchoring Controls 166
Changing the Startup Form 167
Connecting the Dialog 167
Using the ListView and TreeView Controls 170
Building an ImageList 170
Adding a ListView 172
Using the Details View 173
Attaching a Context Menu 174
Adding a TreeView 175
Adding a Splitter 177
Implementing Drag and Drop 178
Creating Controls 181
Creating a User Control 181
Adding a Property 182
Adding Functionality 182
Writing a Custom Control 183
Testing the Control 187
Enhancing the Control 189
Subclassing Controls 191
Custom Controls in Internet Explorer 193
Setting Up IIS 193
Creating a Virtual Directory 193
Writing a Test Page 194
Summary/Solutions Fast Track/Frequently Asked Questions 196
Chapter 5 Network Programming:
Using TCP and UDP Protocols 203
Introduction 204
Introducing Networking and Sockets 204
Introduction to TCP 206
Introduction to UDP 208
Introduction to Ports 211
System.NetNamespace 212
System.Net.SocketsNamespace 213
Example TCP Command Transmission and Processing 214
General Usage of Needed .NET Classes 216
The Server 217
The Client 220
Compiling and Running the Example 226
Example UDP Command Transmission and Processing 227
General Usage of Needed .NET Classes 228
The Server 229
The Client 231
Compiling and Running the Example 234
Creating a News Ticker Using UDP Multicasting 235
General Usage of Needed .NET Classes 236
The Server 240
The Client 243
Compiling and Running the Example 250
Creating a UDP Client Server Chat Application 250
The TCPServerSessionClass 253
The TCPServerClass 256
The Chat Protocol 260
The ChatServerClass 260
The ChatClientClass 265
Compiling and Running the Example 268
Creating a TCP P2P File Sharing Application 269
The Remote File Stream Protocol 271
The RemoteFileStreamServerClass 272
The RemoteFileStreamProxyClass 276
The FileSharingPeerClass 279
Compiling and Running the Example 283
Access to Web Resources 283
General Usage of Needed .NET Classes 284
A Web Access Client 285
Compiling and Running the Example 289
Request Method 290
Redirection 290
Authentication 291
Cookies 291
Summary/Solutions Fast Track/Frequently Asked Questions 292
Chapter 6 Remoting 299
Introduction 300
Introducing Remoting 301
Remoting Architecture 302
Creating a Simple Remoting Client Server 303
Creating the Remote Server Object 303
Creating the Hosting Application 305
Creating the Client Application 306
Understanding the Remoting Code 308
Improving the Sample Application 310
Adding Event Logging and Error Handling 310
Using the soapsuds Tool 312
Using Configuration Files 313
Updating Configuration Files Using the .NET
Framework Configuration Tool 318
Changing the Hosting Application to a Service 319
Using the TCP Channel with the Binary Formatter 321
Summary of the Improved Sample Application 321
Creating an Intranet Application 321
Object Lifetime and Leasing 321
Creating the CountServer Project 322
Creating the CountHost Project 325
Creating the CountClient Project 326
Understanding the Leasing and Sponsorship Code 329
Client Activated Objects 331
Sending and Receiving Objects by Value 332
Sending and Receiving Objects by Reference 333
Creating Service-Based Applications 334
Building a Versioned Remoting Application 334
Creating the VersionHost Project 336
Creating the VersionClient Project 337
Testing Side-By-Side Execution of Remote Objects 339
Summary/Solution Fast Track/Frequently Asked Questions 340
Chapter 7 Message Queuing Using MSMQ 345
Introduction 346
Introducing MSMQ 346
MSMQ Architecture 348
Installing MSMQ 349
Using Visual Studio to Manage Queues 349
Creating a Simple Application 349
Understanding the Messaging Code 353
Sending Messages 353
Message Formats 355
Sending and Receiving Messages with Complex Objects 356
Storing Files within Messages 360
Setting Queue Options 364
Creating a Complex Application 365
Creating the MSMQGraphics Drawing Library 366
Creating the DrawingSender Project 369
Creating the DrawingReceiver Project 373
Creating an Asynchronous Application 376
Using Public Queues While Disconnected from the Network 378
Summary/Solutions Fast Track/Frequently Asked Questions 379
Chapter 8 ADO.NET 383
Introduction 384
Introducing ADO.NET 384
ADO.NET Architecture 386
Understanding the ConnectionObject 388
Building the Connection String 389
Understanding the CommandObject 391
Understanding DataReaders 396
Understanding DataSets and DataAdapters 396
DataTable 398
DataColumn 398
DataRow 402
Differences between DataReader Model and DataSet Model 405
Understanding the DataViewObject 406
Working with System.Data.OleDb 408
Using DataReaders 408
Using DataSets 414
Working with SQL.NET 418
Using Stored Procedures 419
Working with Odbc.NET 422
Using DSN Connection 423
Summary/Solutions Fast Track/Frequently Asked Questions 426
Chapter 9 Working with XML 431
Introduction 432
Introduction to XML 432
Explaining XML DOM 434
Explaining XPath 435
Explaining XSL 436
Explaining XML Schemas 437
XML Classes in the .NET Framework 437
Working with XML DOM 439
Creating an Empty XML DOM Document 442
Adding an Element to the XML Document 443
Updating an Element in the XML Document 446
Deleting an Element in the XML Document 450
Loading and Saving the XML Document 451
Working with XML and Relational Data 452
XML and the DataSetClass 456
XML Schemas and the DataSetClass 461
Traversing Relations in the DataSetClass 464
Working with XPath and XSL Transformations 469
Working with XPath 469
Working with XSL 479
Summary/Solutions Fast Track/Frequently Asked Questions 490
Chapter 10 ASP.NET 495
Introduction 496
Introducing the ASP.NET Architecture 496
ASP.NET Server Controls 497
Working with User Controls 501
Custom Controls 510
Understanding the Web.config File 511
Using the Global.asax Page 513
Working with Web Forms 513
Creating a Simple Web Form 513
Building an XML Poll 517
Creating the updateXPoll Method 523
Creating the updateFile Method 525
Displaying the Current Poll Statistics 526
Working with ADO.NET 529
Building a Message Board with SQL 529
Using VS.NET to Validate Form Input with a Regular Expression 538
XML and XSLT 543
Using the String Builder Class 547
Building a Shopping Cart with SQL 549
Creating dataaccess.cs 551
Creating XmlShoppingCart.cs 553
Creating catalog.cs 556
Summary/Solutions Fast Track/Frequently Asked Questions 571
Chapter 11 Web Services 575
Introduction 576
The Case for Web Services 576
The Role of SOAP 577
Why SOAP? 578
Why Web Services? 579
The World of Web Services 579
Web Service Standards 581
Wiring Up Distributed Objects—The SOAP Protocol 581
Creating Your Very First Web Service 581
Running Your Very First Web Service 589
Describing Web Services—WSDL 602
Discovering Web Services—DISCO 608
Publishing Web Services—UDDI 610
Working with Web Services 611
Passing Complex Data Types 611
Error Handling 614
Malformed SOAP Request 614
Wrong Argument Types 617
Exceptions in Server Code 617
Writing a SOAP Client Application 619
Passing Objects 626
Passing Relational Data 631
Passing XML Documents 635
Working with UDDI 639
SOAP Headers 646
Advanced Web Services 646
Maintaining State 647
State Information in the URL (URL Mangling) 648
State Information in the Http Header (Cookies) 651
State Information in the Http Body (SOAP Header) 653
Security 662
Summary/Solutions Fast Track/Frequently Asked Questions 664
Chapter 12 Building a Jokes Web Service 669
Introduction 670
Motivation and Requirements for the Jokes Web Service 670
Functional Application Design 672
Defining Public Methods 672
Defining the Database Schema 673
Defining the Web Service Architecture 674
Security Considerations 676
State Management 677
Error Handling 677
Implementing the Jokes Data Repository 677
Installing the Database 678
Creating the Stored Procedures 680
Implementing the Jokes Middle Tier 694
Setting Up the Visual Studio Project 694
Developing the Error Handler 698
Developing the Database Access Component 702
Developing the User Administration Service 704
Adding New Users 704
Checking Existing User Information 709
Adding Moderators 713
Creating the Public Web Methods—Users 715
Error Handling for the Public Web Methods 718
Creating the Public Web Methods—Administrators 720
Testing the Public Web Methods 722
Developing the Jokes Service 724
Best Practices for Returning Highly Structured Data 724
Setting Up Internal Methods to Wrap the Stored Procedure Calls 727
Setting Up Internal Methods to Manage Jokes and Ratings 734
Setting Up Internal Methods to Return Jokes 742
Creating the Public Web Methods 748
Creating a Client Application 758
Some Ideas to Improve the Jokes Web Service 775
Summary/Solutions Fast Track/Frequently Asked Questions 776
Index 781

Download
Another C# Books
Another .NET Books

No comments:

Post a Comment

Related Posts with Thumbnails

Put Your Ads Here!