Expectation Failed (417)

23 views
Skip to first unread message

Obaid ur Rehman

unread,
Jul 11, 2012, 2:25:28 AM7/11/12
to reque...@googlegroups.com
I am trying to a POST request from the following C# snippet and I keep getting a 417 (Expectation Failed) error. Any idea why?

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Timeout = REQUEST_TIMEOUT;
request.Method = "POST";
request.GetRequestStream().Write(System.Text.ASCIIEncoding.ASCII.GetBytes(payload), 0, 
                     System.Text.ASCIIEncoding.ASCII.GetBytes(payload).Length); 
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Obaid

unread,
Jul 11, 2012, 5:01:04 AM7/11/12
to reque...@googlegroups.com
I figured it out. It was sending  Expect: 100-Continue  header on POST request. Removing it solves the problem :-)
Reply all
Reply to author
Forward
0 new messages