The reason why your code didn't work originally is because setting the ServicePoint.Expect100Continue on the static method will set it to false only for all HttpWebRequests created *after* you set it to false. In this case you created your WebRequest prior to setting the flag to false. If you moved it to the beginning of your method you'd be fine. Though if you're building an app using APIs it makes more sense to avoid blanket setting Expect100Continue value to false via the static method.
On Apr 30, 1:14 am, sttester <[email protected]> wrote: > Hi, > > I checked if expect header was still getting added and IT WAS! > > The below link helped > me:http://topomorph.info/post/Finds-a-solution-to-the-Expect-continue-10... > > I changed the WebRequest to HttpWebRequest and the latter has a > ServicePoint.Expect100Continue which needed to be set to 'false' and > removed the System.Net.ServicePointManager.Expect100Continue = false. > > This solved my issue. > > Thanks for your help... :) > > On Apr 27, 9:33 pm, Abraham Williams <[email protected]> wrote: > > > Try running your request through a Charles proxy to make sure the expect > > header is not getting added. > > > On Mon, Apr 27, 2009 at 01:18, sttester <[email protected]> wrote: > > > > Hi, > > > > I am starting this as a new thread because I did not get any reply > > > since 4 days in the below thread: > > > >http://groups.google.com/group/twitter-development-talk/browse_thread... > > > > The '417- Expectation failed error' occurs again for me while updating > > > status. I am using the Yedda Twitter library. I have already added > > > 'System.Net.ServicePointManager.Expect100Continue = false;' to my > > > Posting function: > > > > protected string ExecutePostCommand(string url, string userName, > > > string password, string data) > > > { > > > > WebRequest request = WebRequest.Create(url); > > > if (!string.IsNullOrEmpty(userName) && ! > > > string.IsNullOrEmpty(password)) > > > { > > > request.Credentials = new NetworkCredential(userName, > > > password); > > > request.ContentType = "application/x-www-form- > > > urlencoded"; > > > request.Method = "POST"; > > > System.Net.ServicePointManager.Expect100Continue = > > > false; > > > > etc etc............. > > > > I tried changing the position of > > > 'System.Net.ServicePointManager.Expect100Continue = false;' to above > > > the WebRequest object creation, but that also does n't help. > > > > This occurs in random. Please help me out of this situation as this > > > has been happening since a week now. > > > > Thanks in advance > > > -- > > Abraham Williams |http://the.hackerconundrum.com > > Hacker |http://abrah.am|http://twitter.com/abraham > > Web608 | Community Evangelist |http://web608.org > > This email is: [ ] blogable [x] ask first [ ] private. > > Sent from Madison, WI, United States
