Today's topic is about the UsePostTunneling property on the DataServiceContext type.
The ADO.NET Data Services Framework was designed around RESTful principles, so it maps operations on entities to HTTP methods. So for example:
Unfortunately, not every implementation of the HTTP network stack is happy with these methods. Sometimes only partial support is available; other times an intermediate party like a firewall may choose to deliberatly block requests with certain methods. Bottom line is, GET and POST typically work everywhere, and all other methods have the possibility of running into trouble, sometimes in ways or places that you might not be able to control.
If you happen to be in an environment where methods other than GET and POST are a problem, you can set the UsePostTunneling property to true. When you do this, POST will be used and the real method will go in a custom header. This is generally considered less RESTful because now the request method won't necessarily match the request intent, but it does have the valuable trait of allowing your application to work.
What is the custom header? A "_method" value? Thanks for the reminder about this feature. Though its documentation is rather scant. I'd love some samples of using this tunneling with jQuery and Data Services on the web. Blogs and documentation almost assume the only client apps using this would be Silverlight. But Data Services could be very useful for broader usage, in AJAX cases.
Andy, the custom header name is 'X-HTTP-Method'. Just set its value to whichever HTTP method you would have sent if you didn't have to use the workaround.
IIRC, the server will reject tunneled requests for GET and POST, which should always be available, as a way to provide a further incentive to keep REST semantics aligned with HTTP requests.