以下代码来自互联网,它在行
显示错误 TwitterResponse as - > {"errors":[{"message":"SSL is required","code":92}]}
我需要一些帮助来了解ssl错误,以便我可以从页面发布推文
using System;
using Twitterizer;
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var oauth_consumer_key = "47WM3bdfOIpYz9dfbsaPsrXx4";
var oauth_consumer_secret = "XkxdsbbdfbdsfbbnQyoAxnS8U7q5TOzv";
if (Request["oauth_token"] == null)
{
OAuthTokenResponse reqToken = OAuthUtility.GetRequestToken(
oauth_consumer_key,
oauth_consumer_secret,
Request.Url.AbsoluteUri);
Response.Redirect(
string.Format("https://twitter.com/oauth/authorize?oauth_token={0}",
reqToken.Token));
}
else
{
string requestToken = Request["oauth_token"].ToString();
string pin = Request["oauth_verifier"].ToString();
var tokens = OAuthUtility.GetAccessToken(
oauth_consumer_key,
oauth_consumer_secret,
requestToken,
pin);
OAuthTokens accesstoken = new OAuthTokens()
{
AccessToken = tokens.Token,
AccessTokenSecret = tokens.TokenSecret,
ConsumerKey = oauth_consumer_key,
ConsumerSecret = oauth_consumer_secret
};
TwitterResponse<TwitterStatus> response = TwitterStatus.Update(
accesstoken,"Testing!! It works (hopefully)."); //-->{"errors[{"message":"SSL is required","code":92}]}
if (response.Result == RequestResult.Success)
{
Response.Write("we did it!");
}
else
{
Response.Write("it's all bad.");
}
}
}
}
}
答案 0 :(得分:0)
我得到了结果通过替换TwitterResponse&lt; TwitterStatus&GT;符合以下代码。
TwitterResponse<TwitterStatus> response = TwitterStatus.Update(
accesstoken,
"Testing!! It works (hopefully)2.",
new StatusUpdateOptions() { UseSSL = true, APIBaseAddress = "http://api.twitter.com/1.1/" });