| Acknowledgments | xii |
| Introduction | xiii |
| Finding Your Best Starting Point | xiii |
| Installing the Sample Files | xv |
| Conventions Used in This Book | xvii |
| PART 1 GETTING STARTED WITH ASP.NET | |
| CHAPTER 1 Opening and Running an ASP.NET Web Application | 3 |
| Understanding Microsoft .NET | 3 |
| The .NET Framework | 4 |
| The Common Language Runtime | 4 |
| The .NET Framework Class Library | 5 |
| .NET Languages and Language Tools | 6 |
| Notepad and Other Text Editors | 7 |
| Visual Studio .NET | 7 |
| Visual Basic .NET | 8 |
| C# | 8 |
| Additional .NET Languages | 8 |
| Getting Started with Visual Studio .NET | 9 |
| Visual Studio .NET Basics | 9 |
| The Visual Studio .NET IDE | 15 |
| IDE Enhancements | 16 |
| New Features | 18 |
| IDE Windows | 19 |
| Toolbars | 26 |
| Menus | 27 |
| Options | 28 |
| Exiting Visual Studio .NET | 29 |
| What's New in ASP.NET | 30 |
| Familiar Features | 30 |
| What's New | 30 |
| CHAPTER 2 Creating an ASP.NET Web Application | 33 |
| ASP.NET Project Types | 33 |
| ASP.NET Web Applications | 34 |
| ASP.NET Web Forms | 35 |
| Code-Behind | 35 |
| ASP.NET Web Services | 36 |
| ASP.NET Mobile Web Applications | 36 |
| ASP.NET File Types | 37 |
| Visual Studio .NET | 38 |
| Creating Applications | 39 |
| Adding Server Controls | 42 |
| Building and Testing Your Page | 46 |
| CHAPTER 3 Understanding Programming Basics | 49 |
| Expressions, Variables, and Constants | 50 |
| Expressions | 50 |
| Variables | 51 |
| Data Types | 51 |
| Value Types vs. Reference Types | 52 |
| Declaring Variables | 53 |
| Variable Lifetime | 54 |
| Scope | 56 |
| Accessibility | 57 |
| Constants | 58 |
| Enumerations | 59 |
| Procedures | 60 |
| Sub Procedures | 60 |
| Receiving Input Parameters | 60 |
| Function Procedures | 62 |
| Flow Control | 62 |
| If Statements | 63 |
| Select Case Statements | 63 |
| Looping Statements | 69 |
| Using For. Loops | 69 |
| Using For Each. Loops | 70 |
| Using Do. Loops | 71 |
| Using While.End While Loops | 71 |
| Error Handling | 72 |
| Using the On Error Statement | 73 |
| Using Structured Exception Handling: Try.Catch.Finally | 74 |
| Understanding Object-Oriented Programming Basics | 78 |
| Using Classes as Containers for Code | 80 |
| Using Inheritance | 80 |
| Inheriting from the .NET Base Classes | 82 |
| Inheriting Across Languages | 83 |
| PART 2 ASP.NET INFRASTRUCTURE | |
| CHAPTER 4 Managing State | 87 |
| Using Application State | 88 |
| Synchronizing Access to Application State | 90 |
| Recommendations for Application State | 92 |
| Limitations of Application State | 93 |
| Using Session State | 94 |
| Enabling Session State | 96 |
| Enabling Session State in Visual Studio.NET | 97 |
| Recommendations for Session State | 99 |
| Limitations of Session State | 99 |
| State and Scalability | 100 |
| Configuring Session State Storage | 101 |
| Storing Session State In-Process | 101 |
| Storing Session State Out-of-Process | 101 |
| Storing Session State in SQL Server | 103 |
| Using Cookieless Sessions | 104 |
| Formatting URLs for Cookieless Sessions | 105 |
| Using Client-Side Cookies for State Storage | 105 |
| Using Persistent Cookies | 106 |
| ASP.NET Server Control State | 107 |
| CHAPTER 5 Configuring an ASP.NET Application | 109 |
| Understanding ASP.NET Configuration | 109 |
| Introducing Web.config | 111 |
| Editing Configuration Files | 112 |
| Editing the Master Configuration File | 113 |
| Configuring an ASP.NET Application | 114 |
| Overriding Configuration Settings for Subdirectories | 122 |
| Locking Down Configuration Settings | 123 |
| Running Against a Specific Framework Version | 124 |
| CHAPTER 6 Security in ASP.NET | 127 |
| The Importance of Security | 128 |
| Security Basics | 129 |
| Server Setup and Application Design | 129 |
| Passwords, Please | 141 |
| Limit Those Accounts | 146 |
| No Samples, Thank You | 147 |
| You Need Validation | 148 |
| ASP.NET Request Validation | 149 |
| Patching | 151 |
| Access Control | 154 |
| Auditing and Logging | 155 |
| Using SSL to Protect Communications | 157 |
| Enabling Authentication | 161 |
| Selecting an Authentication Type | 162 |
| Using Windows-Based Authentication | 162 |
| Using .NET Passport Authentication | 165 |
| Using Forms-Based Authentication | 166 |
| Using Authorization | 174 |
| Using NTFS ACLs for Authorization | 174 |
| Using URL-Based Authorization | 175 |
| Using Impersonation | 177 |
| Understanding Code Access Security | 178 |
| Security Resources | 179 |
| PART 3 ASP.NET WEB FORMS | |
| CHAPTER 7 Creating Web Forms | 185 |
| Anatomy of an ASP.NET Web Form | 185 |
| Understanding Page Elements | 186 |
| Understanding Page Lifetime | 188 |
| Using Directives | 190 |
| @ Page Examples | 195 |
| The Page Class | 205 |
| Writing Code in Web Forms | 207 |
| Creating and Using User Controls | 209 |
| Event Handling | 216 |
| Handling Page Events | 218 |
| Handling Control Events | 219 |
| Handling Page Errors | 220 |
| Page Runtime Structure | 221 |
| CHAPTER 8 Using Server Controls | 225 |
| Types of Controls | 225 |
| HTML Controls | 225 |
| Web Controls | 233 |
| Adding Server Controls to a Page | 233 |
| Additional Web Control Examples | 242 |
| RegWiz.aspx | 247 |
| Specialty Controls | 253 |
| Validation Controls | 260 |
| Data-Bound Controls | 266 |
| ASP.NET Mobile Web Applications and Controls | 266 |
| ASP.NET Mobile Controls | 266 |
| CHAPTER 9 Accessing and Binding Data | 275 |
| Understanding ADO.NET | 276 |
| Understanding .NET Data Providers | 276 |
| Understanding Datasets | 278 |
| Creating and Opening Connections | 279 |
| SqlConnection | 279 |
| OleDbConnection | 282 |
| Using Trusted Connections | 283 |
| Reading and Updating Data with Commands | 286 |
| SqlCommand | 286 |
| OleDbCommand | 292 |
| Using Stored Procedures | 295 |
| Using Datasets | 297 |
| Using DataAdapter Objects | 297 |
| Reading XML Data | 298 |
| Using DataTable, DataColumn, and DataRow Objects | 298 |
| Updating Datasets | 308 |
| Typed Datasets | 309 |
| Using DataView Objects | 317 |
| Reading Data with DataReader Objects | 318 |
| SqlDataReader | 318 |
| OleDbDataReader | 319 |
| Data Binding | 319 |
| Simple Data Binding | 320 |
| Binding to Controls | 321 |
| Using DataBinder.Eval | 323 |
| Using the Data-Bound Controls | 323 |
| PART 4 BEYOND THE BASICS | |
| CHAPTER 10 Creating Custom Server Controls | 347 |
| Creating Your First Control | 348 |
| Creating a Namespace | 349 |
| Creating a Class | 349 |
| Inheriting from a Base Class | 350 |
| Rendering Output from a Control | 351 |
| Building Your First Control in Visual Studio .NET | 352 |
| Adding Functionality | 360 |
| Adding Properties and Methods | 360 |
| Creating More Advanced Controls | 363 |
| Handling Postbacks | 364 |
| Creating, Raising, and Handling Events | 365 |
| A Registration and Login Control | 370 |
| Maintaining State | 396 |
| Creating Custom Controls Through Composition | 398 |
| CHAPTER 11 Creating and Using Web Services | 403 |
| Understanding XML-Based Web Services | 403 |
| SOAP and Web Services | 406 |
| Additional Needs for Web Services | 406 |
| Creating a Web Service | 407 |
| Declaring a Web Service | 407 |
| Creating the Web Service Class | 408 |
| Advertising a Web Service | 418 |
| Chapter_11.disco | 419 |
| Securing a Web Service | 420 |
| Exploring Authentication Options | 421 |
| Using a Web Service | 423 |
| Locating a Web Service | 423 |
| Understanding WSDL Files | 425 |
| Creating a Proxy Class | 426 |
| MakeServices.bat | 428 |
| How the Proxy Code Works | 432 |
| Additional Resources | 432 |
| CHAPTER 12 Using Caching to Improve Performance | 435 |
| Understanding Caching | 435 |
| Using Output Caching | 436 |
| Using the @ OutputCache Directive | 436 |
| Using Response.Cache | 446 |
| Caching Arbitrary Data | 447 |
| Using the Cache APIs | 450 |
| CHAPTER 13 Deploying an ASP.NET Application | 459 |
| Understanding the Structure of ASP.NET Applications | 460 |
| Distinguishing Between Physical Path and URL | 463 |
| Storing Application-Specific Configuration Settings | 465 |
| Deploying a Web Application Manually | 467 |
| Setting Up the Target Deployment Directory | 467 |
| Copying Files to the Target Directory | 467 |
| Setting IIS Permissions for Subdirectories | 469 |
| Deployment Options in Visual Studio .NET | 471 |
| Using Copy Project to Deploy a Web Application | 471 |
| Using a Web Setup Project to Deploy a Web Application | 472 |
| CHAPTER 14 Tracing and Debugging ASP.NET Applications | 477 |
| Tracing | 478 |
| Enabling Page-Level Trace Output | 478 |
| Enabling Application-Level Trace Output | 480 |
| Writing to the Trace Output | 481 |
| Understanding the Trace Output | 484 |
| Debugging | 485 |
| Understanding Bug Categories | 485 |
| Preventing Bugs | 486 |
| Compiling Web Forms Pages in Debug Mode | 487 |
| Understanding ASP.NET Error Messages | 490 |
| Using the Visual Studio .NET Debugger | 490 |
| PART 5 APPENDIXES | |
| APPENDIX A Migrating from ASP to ASP.NET | 501 |
| Migration Overview | 501 |
| Page Structure Changes | 501 |
| Language Changes | 503 |
| Migrating a Data Access Page to ASP.NET | 504 |
| GetAuthors2.aspx | 510 |
| Best Practices for Preparing for ASP.NET | 511 |
| APPENDIX B ASP.NET Configuration Elements | 513 |
| <trace> | 513 |
| <globalization> | 514 |
| <httpRuntime> | 516 |
| <compilation> | 519 |
| <pages> | 525 |
| <customErrors> | 528 |
| <authentication> | 530 |
| <identity> | 534 |
| <authorization> | 535 |
| <machineKey> | 537 |
| <securityPolicy> | 538 |
| <trust> | 539 |
| <sessionState> | 540 |
| <httpHandlers> | 542 |
| <httpModules> | 544 |
| <processModel> | 546 |
| <webControls> | 551 |
| <clientTarget> | 551 |
| <browserCaps> | 552 |
| Setting and Retrieving Custom Application Settings | 553 |
| <appSettings> | 553 |
| APPENDIX C Installing Visual Studio .NET 2003 | 555 |
| Before You Install | 555 |
| Installing Visual Studio .NET 2003 | 556 |
| INDEX | 575 |