2013-01-21 243 views
0

我有使用Twitterizer的問題 我想要獲取TwitterUser模型以從Twitter上的響應請求中獲取用戶信息,但我不知道方式。Twitterizer獲取用戶信息

這是我的代碼:

public ActionResult Logon(string oauth_token, string oauth_verifier, string ReturnUrl) 
    { 
     if (string.IsNullOrEmpty(oauth_token) || string.IsNullOrEmpty(oauth_verifier)) 
     { 
      UriBuilder builder = new UriBuilder(this.Request.Url); 
      builder.Query = string.Concat(
       builder.Query, 
       string.IsNullOrEmpty(builder.Query) ? string.Empty : "&", 
       "ReturnUrl=", 
       ReturnUrl); 

      string token = OAuthUtility.GetRequestToken(
       ConfigurationManager.AppSettings["TwitterConsumerKey"], 
       ConfigurationManager.AppSettings["TwitterConsumerSecret"], 
       builder.ToString()).Token; 

      //return Redirect(OAuthUtility.BuildAuthorizationUri(token, true).ToString()); 
      Response.Redirect(string.Format("http://twitter.com/oauth/authenticate?oauth_token={0}&force_login=true", token), true); 
     } 

     var tokens = OAuthUtility.GetAccessToken(
      ConfigurationManager.AppSettings["TwitterConsumerKey"], 
      ConfigurationManager.AppSettings["TwitterConsumerSecret"], 
      oauth_token, 
      oauth_verifier); 
     OAuthTokens accessToken = new OAuthTokens(); 
     accessToken.AccessToken = tokens.Token; 
     accessToken.AccessTokenSecret = tokens.TokenSecret; 
     accessToken.ConsumerKey = ConfigurationManager.AppSettings["TwitterConsumerKey"]; 
     accessToken.ConsumerSecret = ConfigurationManager.AppSettings["TwitterConsumerSecret"]; 
     //TwitterUser u = 


     TwitterUser myTwitterUser = .............. 
     .............. 


    } 

我已經得到了OAuthTokens.After的「.........」我不知道下一步該怎麼做才能得到的信息用戶。

任何人都可以幫助me.Thansk很多

回答

0

你嘗試看documentation

TwitterResponse<TwitterUser> myTwitterUser = TwitterUser.Show(accessToken, "twit_er_izer");