I’m currently creating a Silverlight Twitter client and ran into an error that seems quite well known when developing against the Twitter API, namely the 417 Expectation Failed error or status message.
The solution is – and this works with the WebClient as well as the WebRequest – adding the following line before making the call to Twitter:
ServicePointManager.Expect100Continue = false;
This is not needed for every request: if you are for example adding a status update over the API, then you need to add it. If you are simply requesting a list of messages (friends timeline for example), it’s not needed. So far, everything was OK with my app as well.
However, if you only add it to the places where it’s needed (like said when adding a status) and omitting it in other places, will cause the same error. Turns out that a status update will fail with the same message if you have in the same session queried a list without setting the Expect100Continue.
Bottom line of this story: always set it. It will make your life easier!