Sunday, November 15, 2009

The remote server returned an error: (417) Expectation Failed

Today I thought of playing with Twitter API. Yedda.com had already comeup with a .Net wrapper form Twitter API. So instead of reinventing the wheel decided to this library.

I had no problems calling all the methods except Update method. Update method was throwing

The remote server returned an error: (417) Expectation Failed

After spending for hours I found that the API has HttpWebRequest and the Expect: 100-continue Header Problem. By default - Except100Continue would be true. Make it false and the code should work.

WebRequest request = Web.Create(url);
System.Net.ServicePointManager.Expect100Continue = false;

Happy coding!!!

No comments: