protected void update_Click(object sender, EventArgs e) { BaseHttpRequest httpRequest = HttpRequestFactory.CreateHttpRequest(Method.POST); httpRequest.Token = Session["oauth_token"].ToString(); httpRequest.TokenSecret = Session["oauth_token_secret"].ToString(); httpRequest.UserRemoteIP = Request.UserHostAddress; string url = "http://api.t.sina.com.cn/statuses/update.xml?"; resultTextBox2.Text = httpRequest.Request(url, "status=" + HttpUtility.UrlEncode(statusText.Text)); }
protected void invoke_Click(object sender, EventArgs e) { BaseHttpRequest httpRequest = HttpRequestFactory.CreateHttpRequest(Method.GET); httpRequest.Token = Session["oauth_token"].ToString(); httpRequest.TokenSecret = Session["oauth_token_secret"].ToString(); httpRequest.userid = Session["oauth_user_id"].ToString(); httpRequest.UserRemoteIP = Request.UserHostAddress; string basic = "http://api.t.sina.com.cn/"; string url = ""; switch (this.DropDownList.SelectedIndex) { case 0: url = basic + "statuses/public_timeline.xml"; break; case 1: url = basic + "statuses/friends_timeline.xml"; break; case 2: url = basic + "statuses/user_timeline.xml"; break; case 3: url = basic + "statuses/mentions.xml"; break; case 4: url = basic + "statuses/comments_timeline.xml"; break; case 5: url = basic + "statuses/comments_by_me.xml"; break; case 6: url = basic + "statuses/followers.xml"; break; case 7: url = basic + "users/show.json?user_id=" + httpRequest.userid; break; default: break; } this.resultText.Text = httpRequest.Request(url, string.Empty); }