Expectation Failed when trying to update twitter status

杀马特。学长 韩版系。学妹 提交于 2019-12-02 11:08:36

DotNetOpenAuth doesn't set or support Except100Continue directly. Would be nice if there is a property in the Channel class.

Add this before your call to 'PrepareAuthorizedRequest':

    ((HttpWebRequest)WebRequest.Create
(UpdateStatusEndpoint.Location)).ServicePoint.Expect100Continue = false;

Except100Continue is set depending on the called URL. So you can set it before the connection is created. You may even set it globally in the config file.

  <system.net>
    <settings>
      <servicePointManager expect100Continue="false" />
    </settings>
  </system.net>

Set the Expectation to "expect:nothing" ..this is my code:

var data = new Dictionary();

data.Add("status", status);

HttpWebRequest request = twitter.PrepareAuthorizedRequest(UpdateStatusEndpoint, accessToken, data);

request.Expect = "expect:nothing";

var response = twitter.Channel.WebRequestHandler.GetResponse(request); exception return XDocument.Load(XmlReader.Create(response.GetResponseReader()));

it worked for me...

LinqToTwitter is a Twitter client library that uses DotNetOpenAuth. I'll see about adding a message posting example to the DotNetOpenAuth core library for a future version.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!