3
protected void Page_Load(object sender, EventArgs e)
        {
            var oauth_consumer_key = "pUw6DN1vh2PRhqIQd0w";
            var oauth_consumer_secret = "uCrFLs6x3LlKd6G9YZ2XSzvjiQZmfAM1z3TTEus";

            if(Request["oauth_token"] == null)
            {
                OAuthTokenResponse reqToken = OAuthUtility.GetRequestToken(
                    oauth_consumer_key,
                    oauth_consumer_secret,
                    Request.Url.AbsoluteUri);

                Response.Redirect(string.Format("http://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).");

                if(response.Result == RequestResult.Success)
                {
                    Response.Write("we did it!");
                }
                else
                {
                    Response.Write("it's all bad.");
                }

            }           
        }

I have integrate twitter in asp.net. but always giving me response.Result 'UNKNOWN' Message "it's all bad." i dont know what happen from my end. Install-Package twitterizer - Version 2.4.2 Refer this link Twitter Integration Link

Dale Fraser
  • 4,623
  • 7
  • 39
  • 76
ND's
  • 2,155
  • 6
  • 38
  • 59
  • I suggest reading https://dev.twitter.com/docs/auth/implementing-sign-twitter can solve your issue. – MACMAN Apr 21 '14 at 04:51

2 Answers2

1

This is because of access is Unauthorized. please check TwitterStatus of your response object.

Alternatively, can you please check this Updated Twitterizer Integration Code.

Palak Bhansali
  • 731
  • 4
  • 10
0

If you are running application in localhost then you have to specify localhost url and port in twitter app url like 127.0.0.1:3000. My problem was solved using this.

Dave
  • 4,376
  • 3
  • 24
  • 37