Rick Strahl's Web Log
Wind, waves, code and everything in between...
WebLog Posts in Category Web Api
April, 2016 (4)
March, 2016 (3)
February, 2016 (2)
January, 2016 (5)
December, 2015 (1)
November, 2015 (3)
October, 2015 (1)
September, 2015 (2)
August, 2015 (2)
July, 2015 (5)
June, 2015 (5)
May, 2015 (5)
April, 2015 (3)
March, 2015 (5)
February, 2015 (4)
January, 2015 (5)
December, 2014 (3)
November, 2014 (2)
October, 2014 (3)
September, 2014 (2)
August, 2014 (1)
July, 2014 (2)
June, 2014 (4)
May, 2014 (3)
Visual Studio (39)
Web Services (18)
Web Api (16)
Sql Server (8)
Microsoft AJAX (8)
West Wind Ajax Toolkit (7)
Web Connection (7)
Entity Framework (6)
Html Help Builder (5)
Live Writer (5)
Source Control (4)
Visual Studio (4)
Help Builder (3)
Software Development (3)
Internet Explorer (2)
ASP.NET vNext (2)
Web Deployment Projects (1)
Web Design (1)
Dynamic Types (1)
Control Development (1)
Accepting Raw Request Body Content with ASP.NET Web API
December 13, 2013 - Maui, HI
One ASP.NET Web API related question that frequently comes up frequently is how to capture the raw request content to a simple parameter on a controller method. Turns out that's not as easy as it should be. In this post I discuss how to natively capture the raw request content and then create a [NakedBody] attribute that makes it easy capture the raw content in a string or byte parameter.
A WebAPI Basic Authentication MessageHandler
April 30, 2013 - Maui, Hawaii
In my last post I showed how to create a basic authentication filter for custom authentication within your applications. This time I repeat the excercise with a MessageHandler to demonstrate the differences between the two approaches.
A WebAPI Basic Authentication Authorization Filter
April 18, 2013 - Maui, Hawaii
Recently I needed to implement user based security in a Web API application that's easily accessible from a variety of clients. The customer asked specifically for Basic Auth support and so needed to implement custom Basic Auth support. In this post I describe a simple AuthorizationFilter based implementation of Basic Authentication for Web API.
WebAPI: Getting Headers, QueryString and Cookie Values
April 15, 2013 - Maui, Hawaii
Finally got tired to trying to remember how to get at the Headers, Cookies and QueryString 'collections' in Web API, since there's zero consistency and messy nested collections to deal with. Here's are a set of extension methods that make it easier.
Passing multiple simple POST Values to ASP.NET Web API
September 11, 2012 - Maui, Hawaii
One feature conspicuously missing from ASP.NET Web API is the inability to map multiple urlencoded POST values to Web API method parameters. In this post I show a custom HttpParameterBinding that provides this highly useful functionality for your Web APIs.
ASP.NET Frameworks and Raw Throughput Performance
September 04, 2012 - Maui, Hawaii
I got curious the other day: How do the various ASP.NET framework compare in raw throughput performance? With so many development choices on the ASP.NET stack available today it's interesting to take an informal look at how raw throughput performance compares.
Using JSON.NET for dynamic JSON parsing
August 30, 2012 - Maui, Hawaii
Parsing JSON dynamically rather than statically serializing into objects is becoming much more common with today's applications consuming many services of varying complexity. Sometimes you don't need to map an entire API, but only need to parse a few items out of a larger JSON response. Using JSON.NET and JObject,JArray,JValue makes it very easy to dynamically parse and read JSON data at runtime and manipulate it in a variety of different ways. Here's how.
An Introduction to ASP.NET Web API
August 21, 2012 - Maui, Hawaii
This article is a hands on tour of ASP.NET Web Api. It covers a fair variety of functionality and goes beyond the most basic introductions by digging into some of the mundane details you're likely to run when first starting out with Web API.
Mapping UrlEncoded POST Values in ASP.NET Web API
August 16, 2012 - Maui, Hawaii
Surprsingly Web API does not support POST value mapping to multiple simple parameters on a Web API endpoint. While you can map POST values with model binding or the FormDataCollection native parameter mapping in Web API is a missing feature. Here's what you can and can't do with POST values in Web API.
Where does ASP.NET Web API Fit?
August 07, 2012 - Maui, Hawaii
With the pending release of ASP.NET Web API we're finally getting a good HTTP Service solution 'in the box ' in ASP.NET. Web API provides many needed and cool features, but it's not always clear whether you should use Web API or some other technology like MVC to handle HTTP service requests. In this post I discuss what Web API is and a few options of where it fits and potentially doesn't fit.
Passing multiple POST parameters to Web API Controller Methods
May 08, 2012 - Maui, Hawaii
Web API allows for RPC style method access, but there are differences from older Microsoft AJAX APIs when it comes to passing multiple parameters. Here's how Web API handles parameters and how you can optionally manage multiple parameters to API Controller methods.
Creating a JSONP Formatter for ASP.NET Web API
April 02, 2012 - Maui, Hawaii
Web API doesn't include native JSONP support, but it's pretty easy to create a custom formatter that handles this task. Here's how to create a JsonpFormatter and hook it up as well as a short review of how JSONP works.
ASP.NET Web API and Simple Value Parameters from POSTed data
March 21, 2012 - Maui, Hawaii
There are a few odd behaviors with Web API and its handling of simple parameters to Controller methods. While complex values serialize just fine, simple values like strings and dates and form variables require special attention.
Dynamic JSON Parsing in .NET with JsonValue
March 19, 2012 - Maui, Hawaii
The JsonValue/JsonObject/JsonArray classes in the System.Json are new for the full .NET framework and recently introduced with the various betas of ASP.NET (and previously WCF) Web API. JsonValue fills the need for dynamically parsing and serializing of JSON at runtime.
Using an alternate JSON Serializer in ASP.NET Web API
March 09, 2012 - Maui, Hawaii
The default serializer in ASP.NET Web API (at least in Beta) is the DataContractJsonSerializer with all of its warts and inability to not serializer non-typed objects. In this post I'll talk about the issues and how to plug-in alternate JSON parsers to handle more complete JSON serialization in Web API.
Removing the XML Formatter from ASP.NET Web API Applications
March 09, 2012 - Maui, Hawaii
When viewing ASP.NET Web API output in browsers the content is usually displayed as XML which is not my preferred choice. Even though JSON is Web APIs default format XML continues to be displayed. Here's some discussion on why this happens and how you can work around it.