Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable the “Expect: 100 continue” header in WinRT's HttpWebRequest

I'm developing an app that for legacy code reasons I can't upgrade for the new HttpClient so I'm using HttpWebRequests.

In .NET 4 we could deactivate the Expect header (on posts requests) using ServicePoint.Expect100Continue property, but on WinRT it's not available.

How can this be accomplished on WinRT?

EDIT: System.Net.ServicePointManager.Expect100Continue is not available either.

like image 657
DVD Avatar asked Jan 30 '13 01:01

DVD


People also ask

What is expect 100-continue?

The client will expect to receive a 100-Continue response from the server to indicate that the client should send the data to be posted. This mechanism allows clients to avoid sending large amounts of data over the network when the server, based on the request headers, intends to reject the request.

What is expect100continue HttpWebRequest?

HttpWebRequest automatically appends an Expect: 100-continue header for POST requests. Various sources around the internet suggest that this can be disabled as follows: System. Net.


1 Answers

var c = new HttpClient(); c.DefaultRequestHeaders.ExpectContinue = false; 
like image 52
Flatliner DOA Avatar answered Sep 28 '22 01:09

Flatliner DOA