private string FetchTwitterProfile(string screenName) { string empty = string.Empty; string str = string.Empty; TwitterAuth twitterAuth = new TwitterAuth(TwitterConnect.API_Key, TwitterConnect.API_Secret, this.CallBackUrl); if ((this.OAuthToken == null ? false : this.OAuthTokenSecret != null)) { twitterAuth.TokenSecret = this.OAuthToken; twitterAuth.Token = this.OAuthTokenSecret; twitterAuth.OAuthVerifier = HttpContext.Current.Request.QueryString["oauth_verifier"]; } else { twitterAuth.AccessTokenGet(HttpContext.Current.Request.QueryString["oauth_token"], HttpContext.Current.Request.QueryString["oauth_verifier"]); this.OAuthToken = twitterAuth.TokenSecret; this.OAuthTokenSecret = twitterAuth.Token; } if (twitterAuth.TokenSecret.Length <= 0) { throw new Exception("Invalid Twitter token."); } empty = "https://api.twitter.com/1.1/users/show.json"; if (screenName == null) { screenName = twitterAuth.ScreenName; } str = twitterAuth.OAuthWebRequest(TwitterAuth.Method.GET, empty, string.Format("screen_name={0}", screenName)); return(str); }
public void Tweet(string content) { string empty = string.Empty; string str = string.Empty; TwitterAuth twitterAuth = new TwitterAuth(TwitterConnect.API_Key, TwitterConnect.API_Secret, this.CallBackUrl); if ((this.OAuthToken == null ? false : this.OAuthTokenSecret != null)) { twitterAuth.TokenSecret = this.OAuthToken; twitterAuth.Token = this.OAuthTokenSecret; twitterAuth.OAuthVerifier = HttpContext.Current.Request.QueryString["oauth_verifier"]; } else { twitterAuth.AccessTokenGet(HttpContext.Current.Request.QueryString["oauth_token"], HttpContext.Current.Request.QueryString["oauth_verifier"]); this.OAuthToken = twitterAuth.TokenSecret; this.OAuthTokenSecret = twitterAuth.Token; } if (twitterAuth.TokenSecret.Length > 0) { empty = "https://api.twitter.com/1.1/statuses/update.json"; str = twitterAuth.OAuthWebRequest(TwitterAuth.Method.POST, empty, string.Concat("status=", TwitterBase.UrlEncode(content))); } }