Book description
Practical ASP.NET Web API provides you with a hands-on and code-focused demonstration of the ASP.NET Web API in action. From the very beginning, you'll be writing working code in order to see best practices and concepts in action. As the book progresses, the concepts and code will become more sophisticated. Beginning with an overview of the web service model in general and Web API in particular, you'll progress quickly to a detailed exploration of the request binding and response formatting that lie at the heart of Web API. You'll investigate various scenarios and see how they can be manipulated to achieve the results you need.
Later in the book more sophisticated themes will be introduced that will set your applications apart from the crowd. You'll learn how you can validate the request messages on arrival, how you can create loosely coupled controllers, extend the pipeline processing to compartmentalize your code for security and unit testing before being put onto a live hosting server.
What you'll learn
What ASP.NET Web API is and how it can be used effectively
Ways to optimize your code for readability and performance
What controller dependencies are and why they matter
How to maintain robust security across your projects
Reliable best-practices for using Web API in a professional context
Who this book is for
The book is ideal for any .NET developer who wants to learn how the ASP.NET Web API framework works in a realistic setting. A good working knowledge of C# and the .NET framework and a familiarity with Visual Studio are the only pre-requisites to benefit from this book
Table of contents
- Title Page
- Dedication
- Contents at a Glance
- Contents
- About the Author
- About the Technical Reviewer
- Introduction
- CHAPTER 1: Building a Basic Web API
-
CHAPTER 2: Debugging and Tracing
- 2.1 Using Fiddler for Web Debugging
- 2.2 Capturing Console App Traffic through Fiddler
- 2.3 Capturing HTTPS Traffic in Fiddler
- 2.4 Composing and Submitting Requests in Fiddler
- 2.5 Using F12 Developer Tools in Internet Explorer
- 2.6 Using Developer Tools in Chrome
- 2.7 Enabling ASP.NET Web API Tracing
- 2.8 Creating a Custom Trace Writer
- 2.9 Tracing Entry and Exit
- 2.10 Tracing from Your Code
- 2.11 Tracing Request and Response Messages
- Summary
-
CHAPTER 3: Media-Type Formatting CLR Objects
- 3.1 Listing the Out-of-Box Media Formatters
- 3.2 Understanding Conneg
- 3.3 Requesting a Content Type through the Query String
- 3.4 Requesting a Content Type through the Header
- 3.5 Implementing a Custom Media Type Mapping
- 3.6 Overriding Conneg and Returning JSON
- 3.7 Piggybacking on Conneg
- 3.8 Creating a Custom Media Formatter
- 3.9 Extending an Out-of-Box Media Formatter
- 3.10 Controlling Which Members Are Serialized
- 3.11 Controlling How Members Are Serialized
- 3.12 Returning Only a Subset of Members
- Summary
- CHAPTER 4: Customizing Response
-
CHAPTER 5: Binding an HTTP Request into CLR Objects
- 5.1 Reading the Raw HTTP Request
- 5.2 Reading the HTTP Request into a CLR Type
- 5.3 Binding the HTTP Request to Simple Types
- 5.4 Binding the HTTP Request to Complex Types
- 5.5 Binding the HTTP Request to a Collection
- 5.6 Binding the Form Data
- 5.7 Binding dd/MM/yyyy Dates
- 5.8 Using TypeConverter
- 5.9 Creating a Custom Value Provider
- 5.10 Creating a Custom Model Binder
- 5.11 Creating a Custom Parameter Binder
- 5.12 Creating a Custom Media Formatter
- Summary
- CHAPTER 6: Validating Requests
-
CHAPTER 7: Managing Controller Dependencies
- 7.1 Taking Dependency on the Entity Framework
- 7.2 Inverting Entity Framework Dependencies
- 7.3 Using the Repository Pattern
- 7.4 Using the Generic Repository Pattern
- 7.5 Mapping a Domain to Data Transfer Object (DTO)
- 7.6 Injecting Dependencies Using StructureMap
- 7.7 Unit-Testing the Controller
- Summary
- CHAPTER 8: Extending the Pipeline
- CHAPTER 9: Hosting ASP.NET Web API
- CHAPTER 10: Securing ASP.NET Web API
- CHAPTER 11: Consuming ASP.NET Web API
- CHAPTER 12: Building a Performant Web API
- Index
Product information
- Title: Practical ASP.NET Web API
- Author(s):
- Release date: August 2013
- Publisher(s): Apress
- ISBN: 9781430261759
You might also like
book
Mastering ASP.NET Web API
Leverage ASP.Net Web API to build professional web services and create powerful applications. About This Book …
book
Pro ASP.NET Web API: HTTP Web Services in ASP.NET
Pro ASP.NET Web API shows you how to build flexible, extensible web services that run seamlessly …
book
Pro ASP.NET Web API Security: Securing ASP.NET Web API
ASP.NET Web API is a key part of ASP.NET MVC 4 and the platform of choice …
book
Expert ASP.NET Web API 2 for MVC Developers
Web API 2 is the latest evolution of Microsoft's web services toolkit, which allows the creation …