Rick Strahl's Web Log
Wind, waves, code and everything in between...
WebLog Posts in Category Web Api
Accepting Raw Request Body Content with ASP.NET Web API
December 13, 2013 @ 3:35am
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 @ 3:29am
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 @ 11:35am
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 @ 3:48am
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 @ 4:27am
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 @ 6:13pm
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 @ 5:04am
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 @ 2:41am
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 @ 12:42pm
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 @ 4:34pm
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 @ 10:29pm
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 @ 5:03pm
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 @ 5:05pm
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 @ 3:09am
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 @ 3:30am
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 @ 1:51am
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.
March, 2015 (4)
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)
April, 2014 (1)
March, 2014 (2)
February, 2014 (2)
January, 2014 (3)
December, 2013 (4)
November, 2013 (5)
October, 2013 (4)
September, 2013 (3)
August, 2013 (2)
July, 2013 (3)
June, 2013 (4)
May, 2013 (2)
April, 2013 (5)
Visual Studio (38)
Web Services (17)
Web Api (16)
Microsoft AJAX (8)
Web Connection (7)
Sql Server (7)
West Wind Ajax Toolkit (7)
Live Writer (5)
Entity Framework (5)
Html Help Builder (5)
Visual Studio (4)
Source Control (4)
Software Development (3)
Help Builder (3)
Internet Explorer (2)
ASP.NET vNext (2)
Web Deployment Projects (1)
Web Design (1)
Control Development (1)
Dynamic Types (1)
© Rick Strahl, West Wind Technologies, 2005 - 2015