You are previewing Pro ASP.NET 4.5 in C#, Fifth Edition.
O'Reilly logo
Pro ASP.NET 4.5 in C#, Fifth Edition

Book Description

ASP.NET 4.5 remains Microsoft's preferred technology for creating dynamic websites, providing developers with unrivaled power and flexibility.

Pro ASP.NET 4.5 in C# is the most complete reference to ASP.NET that you will find. This comprehensively revised fifth edition will teach you everything you need to know in order to create well-designed ASP.NET websites. Beginning with core concepts the book progresses steadily through key professional skills. You'll be shown how to query databases in detail, consider the myriad applications of XML, and step through all the considerations you need to be aware of when securing your site from intruders. Finally, you'll consider advanced topics such as using client-side validation, jQuery and Ajax.

By the time you have read this book you will have learned all the skills you need to use ASP.NET 4.5 with confidence.

What you'll learn

  • Understand why ASP.NET 4.5 is so special, what its fundamental principles are, the basics of Visual Studio, how ASP.NET controls are created and how they fit into ASP.NET pages, ultimately creating full applications.

  • Become familiar with Web API , one of the biggest additions to ASP.NET 4.5, and understand how to use it and integrate it within your existing ASP.NET applications.

  • Discover and the Entity Framework and how to perform data binding to in web applications.

  • Learn the ASP.NET security features and how to best apply them.

  • Examine in detail advanced user interface techniques, including user controls, server controls, custom controls and client-side JavaScript.

  • Use HTML and jQuery with an emphasis on contemporary web development techniques.

Who this book is for

This book is aimed at developers with a basic understanding on the .NET Framework who want to learn how to use it in a professional environment. Migrating readers without this foundation would be well served by reading Beginning ASP.NET 4.5 in C#, also by Apress, before tackling this book.

Table of Contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Author
  6. About the Technical Reviewer
  7. Acknowledgments
  8. PART 1: Getting Started
    1. CHAPTER 1: Your First ASP.NET Application
      1. Preparing Your Workstation
      2. Creating a New ASP.NET Project
      3. Creating a Simple Application
      4. Creating the Summary View
      5. Performing Validation
      6. Summary
    2. CHAPTER 2: Putting ASP.NET in Context
      1. An Overview of the ASP.NET Framework
      2. About This Book
      3. The Structure of This Book
      4. Understanding Web Forms
      5. Summary
    3. CHAPTER 3: Essential C# Language Features
      1. Creating the Example Project
      2. Using Automatically Implemented Properties
      3. Using Object and Collection Initializers
      4. Using Extension Methods
      5. Using Lambda Expressions
      6. Using Automatic Type Inference
      7. Using Anonymous Types
      8. Using Generic Typing
      9. Explicitly Implementing Interfaces
      10. Performing Language Integrated Queries
      11. Using Async Methods
      12. Summary
    4. CHAPTER 4: Using jQuery
      1. Creating the Example Project
      2. Getting Started with jQuery
      3. Selecting Elements
      4. Using jQuery Events
      5. Working with JSON Data
      6. Summary
    5. CHAPTER 5: Essential Development Tools
      1. Creating the Example Project
      2. Using the Visual Studio Debugger
      3. Using the Page Inspector and Browser F12 Tools
      4. Using NuGet
      5. Using Opera Mobile
      6. Useful JavaScript Libraries
      7. Summary
    6. CHAPTER 6: SportsStore: A Real Application
      1. Creating the Project
      2. Creating the Data Model and Repository
      3. Creating the Product Listing
      4. Adding Pagination
      5. Styling the List Web Form
      6. Summary
    7. CHAPTER 7: SportsStore: Navigation & Cart
      1. Configuring URL Routing
      2. Adding the Category Information
      3. Building the Shopping Cart
      4. Summary
    8. CHAPTER 8: SportsStore: Completing the Cart
      1. Removing Unwanted Cart Items
      2. Adding the Cart Summary
      3. Submitting Orders
      4. Adding Validation
      5. Summary
    9. CHAPTER 9: SportsStore: Administration
      1. Adding the Common Building Blocks
      2. Adding Order Management
      3. Adding Catalog Management
      4. Setting up Authorization
      5. Summary
    10. CHAPTER 10: SportsStore: Deployment
      1. Disabling Debug Mode for Final Testing
      2. Preparing Windows Azure
      3. Deploying the Application
      4. Summary
    11. CHAPTER 11: Testable Web Apps
      1. Understanding the Problem
      2. Understanding the Solution
      3. Creating the Example Project
      4. Implementing the RSVP Page
      5. Adding Unit Testing
      6. Adding Dependency Injection
      7. Completing the Application
      8. Summary
  9. PART 2: The Core ASP.NET Platform
    1. CHAPTER 12: Working with Web Forms
      1. Creating the Example Project
      2. Understanding the Web Form File
      3. Understanding Code-Behind Classes
      4. Understanding How a Web Form Works
      5. Using Master Pages
      6. Summary
    2. CHAPTER 13: Lifecycles and Context
      1. Creating the Example Project
      2. Understanding the Application Lifecycle
      3. Understanding the Request Lifecycle
      4. Understanding Context Objects
      5. Putting It All Together
      6. Summary
    3. CHAPTER 14: Modules
      1. Preparing the Example Application
      2. Understanding Modules
      3. Creating a Module Project
      4. Working with Module Events
      5. Working with the Built-In Modules
      6. Putting It All Together
      7. Summary
    4. CHAPTER 15: Handlers
      1. Preparing the Example Application
      2. Understanding Handlers
      3. Handlers and the Request Lifecycle
      4. Creating a Generic Handler
      5. Creating Custom Handlers
      6. Creating Custom Handler Factories
      7. Coordinating between Modules and Handlers
      8. Putting It All Together
      9. Summary
    5. CHAPTER 16: Page and Control Lifecycle Events
      1. Preparing the Example Application
      2. Understanding the Page Class
      3. Understanding the Page Lifecycle
      4. Handling Control Events
      5. Receiving Control Events
      6. Understanding the End-to-End Web Lifecycle
      7. The Page Context
      8. Putting It All Together
      9. Summary
    6. CHAPTER 17: Managing Request Execution
      1. Preparing the Example Application
      2. Using URL Redirection
      3. Managing Handler Selection and Execution
      4. Putting It All Together
      5. Summary
    7. CHAPTER 18: Managing State Data
      1. Creating the Example Application
      2. Understanding State Data
      3. Storing Application Data
      4. Storing User Data
      5. Storing Session Data
      6. Using View Data
      7. Using Cookies
      8. Putting It All Together
      9. Summary
    8. CHAPTER 19: Caching
      1. Preparing the Example Application
      2. Using the Application Cache
      3. Managing Item Caching
      4. Caching with Dependencies
      5. Receiving Cache Notifications
      6. Configuring Caching
      7. Putting It All Together
      8. Summary
    9. CHAPTER 20: Caching Output
      1. Preparing the Example Application
      2. Caching Web Form Output
      3. Selectively Updating Content
      4. Caching User Control Output
      5. Caching Server Control Output
      6. Creating Cache Dependencies
      7. Using a Custom Output Cache
      8. Configuring the Output Cache
      9. Putting It All Together
      10. Summary
    10. CHAPTER 21: Handling Errors
      1. Preparing the Example Project
      2. Understanding Errors
      3. Customizing the Default Behavior
      4. Taking Control of the Error Handling Process
      5. Handling Multiple Errors
      6. Putting It All Together
      7. Summary
    11. CHAPTER 22: Managing Paths
      1. Preparing the Example Project
      2. Working with Paths
      3. Managing Virtual Paths
      4. Using the Friendly URLs Package
      5. Putting It All Together
      6. Summary
    12. CHAPTER 23: URL Routing
      1. Preparing the Example Project
      2. Preparing the Application for Routing
      3. Working with Fixed Routes
      4. Adding Variable Segments
      5. Model Binding to Route Segment Values
      6. Generating Outgoing URLs
      7. Putting It All Together
      8. Summary
    13. CHAPTER 24: Advanced URL Routing
      1. Preparing the Example Project
      2. Using Advanced Constraints
      3. Routing Requests for Files
      4. Working with Routing Handlers
      5. Creating a Custom RouteBase Implementation
      6. Putting It All Together
      7. Summary
    14. CHAPTER 25: Authentication and Authorization
      1. Preparing the Example Project
      2. Understanding Forms Authentication
      3. Configuring ASP.NET Authentication
      4. Performing Authentication
      5. Performing Authorization
      6. Bypassing Authorization
      7. Authorization Routed URLs
      8. Putting It All Together
      9. Summary
    15. CHAPTER 26: Membership
      1. Preparing the Example Project
      2. Adding Membership to the Application
      3. Using Membership
      4. Putting It All Together
      5. Summary
    16. CHAPTER 27: ASP.NET Configuration
      1. Preparing the Example Project
      2. Understanding the Configuration Hierarchy
      3. Getting Configuration Information Programmatically
      4. Creating Custom Configuration Sections and Groups
      5. Using External Configuration Files
      6. Locking Configuration Sections
      7. Putting It All Together
      8. Summary
    17. CHAPTER 28: Asynchronous Request Handling
      1. Preparing the Example Project
      2. Understanding the Problem
      3. Creating an Asynchronous Web Form
      4. Creating Asynchronous Modules
      5. Creating Asynchronous Handlers
      6. Summary
  10. PART 3: Forms and Controls
    1. CHAPTER 29: Working with Controls
      1. Preparing the Example Project
      2. Understanding Controls
      3. Working with the Control Hierarchy
      4. Putting It All Together
      5. Summary
    2. CHAPTER 30: Forms and Request Validation
      1. Preparing the Example Project
      2. Understanding the Server-Side Form Element
      3. Detecting Form Posts and Postbacks
      4. Working with Form Data
      5. Understanding the One-Form Limit
      6. Understanding Request Validation
      7. Putting It All Together
      8. Summary
    3. CHAPTER 31: Creating Custom Controls
      1. Preparing the Example Project
      2. Creating a Basic Control
      3. Adding Functionality to the Control
      4. Understanding Control IDs
      5. Defining Element Attributes
      6. Creating a Server Control
      7. Putting It All Together
      8. Summary
    4. CHAPTER 32: Stateful Controls
      1. Preparing the Example Project
      2. Understanding Statelessness and the Control Lifecycle
      3. Managing Application View State
      4. Putting It All Together
      5. Summary
    5. CHAPTER 33: Server-Side HTML Elements
      1. Preparing the Example Project
      2. Understanding Server-Side Elements
      3. Working with Page Structure Elements
      4. Working with Form Elements
      5. Working with HTML Tables
      6. Working with Other Elements
      7. Putting It All Together
      8. Summary
    6. CHAPTER 34: Model Binding
      1. Preparing the Example Project
      2. Understanding the Problem
      3. Applying Model Binding
      4. Handling Model Binding and Validation Errors
      5. Using Binding Attributes
      6. Putting It All Together
      7. Summary
    7. CHAPTER 35: Data Binding
      1. Preparing the Example Project
      2. Understanding Data Binding
      3. Writing a Custom Data Control
      4. Putting It Together
      5. Summary
    8. CHAPTER 36: Basic Data Controls
      1. Selecting a Data Control
      2. Preparing the Example Project
      3. Using the List Data Controls
      4. Using the Repeater Control
      5. Putting It All Together
      6. Summary
    9. CHAPTER 37: Complex Data Controls
      1. Preparing the Example Project
      2. Using the FormView Control
      3. Using the ListView Control
      4. Putting It All Together
      5. Summary
    10. CHAPTER 38: Other ASP.NET Controls
      1. Preparing the Example Application
      2. Working with the Rich UI Controls
      3. Selecting a Rich UI Control
      4. Using the Odds-and-Ends Controls
      5. Putting It All Together
      6. Summary
  11. PART 4: Client-Side Development
    1. CHAPTER 39: Managing Scripts and Styles
      1. Preparing the Example Project
      2. Understanding Script Management Issues
      3. Using Bundles
      4. Using Bundling Optimizations
      5. Ensuring Libraries Are Available for Controls
      6. Putting It All Together
      7. Summary
    2. CHAPTER 40: Ajax and Web Services
      1. Preparing the Example Project
      2. Creating Web Services Using Web API
      3. Consuming the Web Service
      4. Dealing with Event Validation
      5. Putting It All Together
      6. Summary
    3. CHAPTER 41: Client-Side Validation
      1. Preparing the Example Project
      2. Using HTML5 Validation
      3. Using the Built-In Validation Controls
      4. Applying Validation Attributes Directly
      5. Removing Validation Policy Duplication
      6. Putting It All Together
      7. Summary
    4. CHAPTER 42: Targeting Mobile Devices
      1. Preparing the Example Project
      2. Identifying Mobile Devices
      3. Switching Master Pages for Mobile Devices
      4. Delivering Different Web Forms
      5. Putting It All Together
      6. Summary
  12. Index