Practical ASRNET. Web API. Badrinarayanan Lakshmiraghavan. Apress*



Similar documents
Developing Windows Azure and Web Services

Developing Windows Azure and Web Services

This module provides an overview of service and cloud technologies using the Microsoft.NET Framework and the Windows Azure cloud.

70-487: Developing Windows Azure and Web Services

MS 20487A Developing Windows Azure and Web Services

This course provides students with the knowledge and skills to develop ASP.NET MVC 4 web applications.

Beginning ASP.NET 4.5

Expert Oracle Application. Express Security. Scott Spendolini. Apress"

MOC DEVELOPING WINDOWS AZURE AND WEB SERVICES

Beginning C# 5.0. Databases. Vidya Vrat Agarwal. Second Edition

Practical Android Projects Lucas Jordan Pieter Greyling

<Insert Picture Here> Oracle Web Cache 11g Overview

ASP.NET MVC. in Action JEFFREY PALERMO JIMMY BOGARD BEN SCHEIRMAN MANNING. (74 w. long.) WITH MVCCONTRIB, N HIBERNATE, AND MORE.

MS 10978A Introduction to Azure for Developers

Schneps, Leila; Colmez, Coralie. Math on Trial : How Numbers Get Used and Abused in the Courtroom. New York, NY, USA: Basic Books, p i.

Oracle Identity Manager

OpenSocial Network Programming

API documentation - 1 -

Expanded contents. Section 1. Chapter 2. The essence off ASP.NET web programming. An introduction to ASP.NET web programming

Ajax Development with ASP.NET 2.0

EVALUATING COMMERCIAL WEB APPLICATION SECURITY. By Aaron Parke

SAV2013: The Great SharePoint 2013 App Venture

Java 7 Recipes. Freddy Guime. vk» (,\['«** g!p#« Carl Dea. Josh Juneau. John O'Conner

Developing ASP.NET MVC 4 Web Applications MOC 20486

Junos Space. Junos Space Security Director Restful Web Services API Reference. Modified: Copyright 2016, Juniper Networks, Inc.

Cloud Powered Mobile Apps with Azure

Transition your MCPD Web Developer Skills to MCPD ASP.NET Developer 3.5 (VB)

Snare System Version Release Notes

How To Write A Web Framework In Java

Mobile Security Jump Start. Wayne Henshaw & Mike Jacobs Progress OpenEdge October 8, 2013

AppFabric. Pro Windows Server. Stephen Kaufman. Danny Garber. Apress. INFORMATIONSBIBLIOTHbK TECHNISCHE. U N! V En SIT AT S R!

vcommander will use SSL and session-based authentication to secure REST web services.

Real Time Data in Web Applications

Programming in C# with Microsoft Visual Studio 2010

Course 10978A Introduction to Azure for Developers

Hack Yourself First. Troy troyhunt.com

How To Fix A Snare Server On A Linux Server On An Ubuntu (Amd64) (Amd86) (For Ubuntu) (Orchestra) (Uniden) (Powerpoint) (Networking

B6: GET /started/with/ HTTP Analysis

socketio Documentation

A GP Service for Enterprise Printing. Kevin Shows, Anadarko Petroleum Kirk Kuykendall, Idea Integration 04/20/2011

Contents. 2 Alfresco API Version 1.0

Developing ASP.NET MVC 4 Web Applications

Enterprise Application Security Workshop Series

10978A: Introduction to Azure for Developers

Enhancing your Web Experiences with ASP.NET Ajax and IIS 7

Oracle Database 11 g Performance Tuning. Recipes. Sam R. Alapati Darl Kuhn Bill Padfield. Apress*

brief contents PART 1 BACKGROUND AND FUNDAMENTALS...1 PART 2 PART 3 BIG DATA PATTERNS PART 4 BEYOND MAPREDUCE...385

Web Security Testing Cookbook*

Check list for web developers

Whats the difference between WCF and Web Services?

The Great Office 365 Adventure

rpafi/tl enterprise Microsoft Enterprise Library 5.0 Develop Enterprise applications using reusable software

Windows PowerShell Cookbook

GOA365: The Great Office 365 Adventure

Programming with the Microsoft.NET Framework Using Microsoft Visual Studio 2005 (VB)

Windows PowerShell. 3.0 Step by Step. Ed Wilson

REST web services. Representational State Transfer Author: Nemanja Kojic

Learn AX: A Beginner s Guide to Microsoft Dynamics AX. Managing Users and Role Based Security in Microsoft Dynamics AX Dynamics101 ACADEMY

Elgg 1.8 Social Networking

ULTEO OPEN VIRTUAL DESKTOP OVD WEB APPLICATION GATEWAY

JavaScript Patterns. Stoyan Stefanov. O'REILLY' Beijing Cambridge Farnham Koln Sebastopol Tokyo

Windows8 Internals, Sixth Edition, Part 1

Beginning Smartphone Web Development

Learning Web App Development

Fairsail REST API: Guide for Developers

Wiley. Automated Data Collection with R. Text Mining. A Practical Guide to Web Scraping and

Service Level Agreement for Windows Azure operated by 21Vianet

This three-day instructor-led course provides students with the tools to extend Microsoft Dynamics CRM 4.0.

Pro NuGet. Second Edition. Maarten Balliauw. Xavier Decoster

ASP.NET Using C# (VS2012)

Introduction to the AirWatch Browser Guide

Developing ASP.NET MVC 4 Web Applications Course 20486A; 5 Days, Instructor-led

Snare System Version Release Notes

MEGA Web Application Architecture Overview MEGA 2009 SP4

C#5.0 IN A NUTSHELL. Joseph O'REILLY. Albahari and Ben Albahari. Fifth Edition. Tokyo. Sebastopol. Beijing. Cambridge. Koln.

MCTS:.NET Framework 4, Web Applications

TROUBLESHOOTING RSA ACCESS MANAGER SINGLE SIGN-ON FOR WEB-BASED APPLICATIONS

Spectrum Technology Platform. Version 9.0. Administration Guide

SBOP Repository Explorer. Installation and Configuration Guide v (2014)

EXAM PRO:Design & Develop Windows Apps Using MS.NET Frmwk 4. Buy Full Product.

Secure Identity Propagation Using WS- Trust, SAML2, and WS-Security 12 Apr 2011 IBM Impact

WebMarshal User Guide

Hadoop: The Definitive Guide

Introduction to Azure for Developers

Sentinet for BizTalk Server SENTINET 3.1

Index. AdWords, 182 AJAX Cart, 129 Attribution, 174

Course MS55077A Project Server 2013 Development. Length: 5 Days

Fusion Installer Instructions

Practical Hadoop. Security. Bhushan Lakhe

Installing Globodox Web Client on Windows Server 2012

Expert Oracle Exadata

Microsoft Dynamics CRM Event Pipeline

For details about using automatic user provisioning with Salesforce, see Configuring user provisioning for Salesforce.

Configuring Salesforce

Siteminder Integration Guide

Transcription:

Practical ASRNET Web API Badrinarayanan Lakshmiraghavan Apress*

Contents J About the Author About the Technical Reviewer Introduction xiii xv xvii Chapter 1: Building a Basic Web API 1 1.1 Choosing ASP.NET Web API or WCF 2 1.2 Exposing an In-Memory List over HTTP 4 1.3 Choosing Configuration over Convention 9 1.4 Playing by the Rules of HTTP 15 1.4.1 Retrieving Resource(s) 16 1.4.2 Creating a Resource with a Server-Generated Identifier 19 1.4.3 Creating a Resource with a Client-Supplied Identifier 20 1.4.4 Overwriting a Resource 21 1.4.5 Updating a Resource 21 1.4.6 Partially Updating (Patching) a Resource 22 1.4.7 Deleting a Resource 24 Summary 25 Chapter 2: Debugging and Tracing 27 2.1 Using Fiddler for Web Debugging 27 2.2 Capturing Console App Traffic through Fiddler 29 2.3 Capturing HTTPS Traffic in Fiddler 31 2.4 Composing and Submitting Requests in Fiddler 33 2.5 Using F12 Developer Tools in Internet Explorer 36 2.6 Using Developer Tools in Chrome 37 vii

2.7 Enabling ASP.NET Web API Tracing 38 2.8 Creating a Custom Trace Writer 40 2.9 Tracing Entry and Exit 42 2.10 Tracing from Your Code 47 2.11 Tracing Request and Response Messages 51 Summary 53 Chapter 3: Media-Type Formatting CLR Objects 55 3.1 Listing the Out-of-Box Media Formatters 56 3.2 Understanding Conneg 57 3.3 Requesting a Content Type through the Query String 61 3.4 Requesting a Content Type through the Header 63 3.5 Implementing a Custom Media Type Mapping 64 3.6 Overriding Conneg and Returning JSON 66 3.7 Piggybacking on Conneg 66 3.8 Creating a Custom Media Formatter 67 3.9 Extending an Out-of-Box Media Formatter 72 3.10 Controlling Which Members Are Serialized 78 3.10.1 Blacklisting Members 78 3.10.2 Whitelistlng Members 79 3.11 Controlling How Members Are Serialized 80 3.11.1 Controlling Member Names 80 3.11.2 Prettifying JSON 80 3.12 Returning Only a Subset of Members 81 Summary 83 Chapter 4: Customizing Response...85 4.1 Negotiating Character Encoding 85 4.2 Supporting DBCS Character Encoding (Shift JIS) 88 4.3 Negotiating Content Encoding (Compression) 90 viii

4.4 Negotiating Language 100 4.4.1 Internationalizing the Messages to the User 100 4.4.2 Internationalizing the Decimal Separators of Numbers 104 4.4.3 Internationalizing the Dates 110 Summary 113 Chapter 5: Binding an HTTP Request into CLR Objects 115 5.1 Reading the Raw HTTP Request 116 5.2 Reading the HTTP Request into a CLR Type 117 5.3 Binding the HTTP Request to Simple Types 119 5.4 Binding the HTTP Request to Complex Types 121 5.5 Binding the HTTP Request to a Collection 123 5.6 Binding the Form Data 124 5.6.1 Binding to FormDataCollection 125 5.6.2 Binding to Custom Class 128 5.6.3 Binding to a Simple Type 130 5.7 Binding dd/mm/yyyy Dates 132 5.8 Using TypeConverter 136 5.9 Creating a Custom Value Provider 139 5.10 Creating a Custom Model Binder 144 5.11 Creating a Custom Parameter Binder 147 5.12 Creating a Custom Media Formatter 152 Summary 155 Chapter 6: Validating Requests 157 6.1 Validation Using Data Annotations 157 6.2 Handling Validation Errors 162 6.3 Extending an Out-of-the-Box Validation Attribute 168 6.4 Creating Your Own Validation Attribute 170 6.5 Implementing the IValidatableObject Interface 172 Summary 173 ix

Chapter 7: Managing Controller Dependencies 175 7.1 Taking Dependency on the Entity Framework 175 7.2 Inverting Entity Framework Dependencies 182 7.3 Using the Repository Pattern 185 7.4 Using the Generic Repository Pattern 188 7.5 Mapping a Domain to Data Transfer Object (DTO) 195 7.6 Injecting Dependencies Using StructureMap 199 7.7 Unit-Testing the Controller 202 Summary 209 Chapter 8: Extending the Pipeline 211 8.1 Creating a Message Handler 212 8.2 Creating an Exception Filter 218 8.3 Creating an Action Filter to Handle Concurrency 220 8.4 Creating a Controller Selector for Versioning 225 Summary 229 Chapter 9: Hosting ASP.NET Web API 231 9.1 Web Hosting ASP.NET Web API 231 9.2 Self-Hosting ASP.NET Web API 245 9.3 In-Memory Hosting ASP.NET Web API 248 Summary 253 Chapter 10: Securing ASP.NET Web API 255 10.1 Implementing Direct Authentication 255 10.2 Implementing Brokered Authentication 264 10.3 Authorizing Requests 271 Summary 273 X

Chapter 11: Consuming ASP.NET Web API 275 11.1 Calling a Web API from a Console Application 275 11.2 Calling a Web API from a WPF Application 279 11.3 Calling a Web API from JavaScript.. 286 Summary 294 Chapter 12: Building a Performant Web API 295 12.1 Creating Asynchronous Action Methods 295 12.2 Pushing Real-time Updates to the Client... 299 12.3 Implementing Simple Web Caching 306 Summary 314 Index 315 xi