«
»

ASP.NET, Programmeren

Twitter Dishing Out 417 – Expectation Failed to .Net Clients

01.14.09 | 4 Comments

BRON: http://blogs.msdn.com/shitals/archive/2008/12/27/9254245.aspx 

This error is seemingly because Twitter servers have started rejecting Expect HTTP header with value “!00-Continue”. I’m not sure if this was planned event or enough warnings were issued to developers but it would be guaranteed to drive you nuts.

The error is because of default behavior in HttpWebRequest object that adds an HTTP header called Expect with value “100-Continue” to almost every outgoing POST request. This header basically tells the server that it’s going to send all the data in form in the next request instead of current request so that if server has redirects or auth then it doesn’t have to resend it all over again. This is a good thing if your web form has lots of data or if you are on low latency network or most servers in the word have either redirects or auth when submitting forms but a bad thing for server performance because now it gets hit twice for each request. I think performance might be the reason Twitter has turned off support for such two partter POST requests which unfortunately happens to be the default for HttpWebRequest.

In any case, it turns out that HttpWebRequest does all these thing under the hood so to get rid of this error you will need to set a static flag in ServicePointManager class like this:

System.Net.ServicePointManager.Expect100Continue = false;Above statement will cause elimination of HTTP Expect header from your calls to Twitter and it will be happy again.

I’m using Yedda’s C# wrapper for Twitter APIs for QckTwit so above line goes in to start of ExecutePostCommand method.

BRON: http://blogs.msdn.com/shitals/archive/2008/12/27/9254245.aspx


4 Comments

have your say

Add your comment below, or trackback from your own site. Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

:

:


«
»

My Index

0-10

A

Adwords campagne beheer

B

bakgerei voor kindjes

C

CE HTML
Community Server

D

E

Elegant
Elegant opinie

F

Familie Anrijs
fotoshoot
professionele familiereportage
fotoshoot
familie fotoshoot
FrontierVille
FrontierVille guides review site

G

GarageTV
garagetv.be
Google Adwords - adverteren op zoekmachines
Google-approved Qualified Professional
Groene stroom

H

huwelijksreportage

I

Internet reclame

J

JWI Consulting

K

Kantoorinrichting
Kaartjes bestellen
kerstkaartjes bestellen
KMO website snelheidstest

L

Lamineerapparaat a3

M

N

O

Online kaartjes bestellen

P

P&O ferries
Philips Net TV
Playmobilkasteel
Portfolio Development (.NET C# PHP)
Portfolio SEO (Search Engine Optimalisatie)
Provinciaal Voetbal
provinciaal voetbal Antwerpen
provinciaal voetbal Branbant
provinciaal voetbal Limburg
provinciaal voetbal Oost-Vlaanderen
provinciaal voetbal West-Vlaanderen

Q

R

S

SEO (Search Engine Optimization)
Snelheids voor kmo websites
Suikerpasta

T

trouwfoto's
trouwfoto's

U

www.uwfotomoment.be

V

verjaardagsfeestjes
Verjaardagsfeestjes voor kindjes
Voetbal uitslagen
online voetbalschoenen kopen

W

google webmaster tools

X

Y

Z

Zoekmachine optimalisatie