System.Net.WebClient WebClientObj<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>= new System.Net.WebClient();</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr><wbr><wbr>System.Collections.Specialized.NameValueCollection PostVars<wbr><wbr>= new System.Collections.Specialized.NameValueCollection();</wbr></wbr></wbr></wbr></wbr>
<wbr><wbr><wbr>PostVars.Add("A1","0");</wbr></wbr></wbr>
<wbr><wbr><wbr>PostVars.Add("A2","0");</wbr></wbr></wbr>
<wbr><wbr><wbr>PostVars.Add("A3","000");</wbr></wbr></wbr>
<wbr><wbr><wbr>try<br><wbr><wbr><wbr>{<br><wbr><wbr><wbr><wbr>byte[] byRemoteInfo<wbr><wbr><wbr>= WebClientObj.UploadValues("http://www.lovezhao.com/vote.asp","POST",PostVars);<br><wbr><wbr><wbr><wbr>//下面都没用啦,就上面一句话就可以了<br><wbr><wbr><wbr><wbr>string sRemoteInfo<wbr><wbr><wbr>= System.Text.Encoding.Default.GetString(byRemoteInfo);<wbr><wbr><br><wbr><wbr><wbr><wbr>//这是获取返回信息<br><wbr><wbr><wbr><wbr>richTextBox_instr.Text<wbr><wbr>+= sRemoteInfo;<br><wbr><wbr><wbr>}<br><wbr><wbr><wbr>catch<br><wbr><wbr><wbr>{}<br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
方法二、
string url = "网址";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
string s = "要提交的数据";
byte[] requestBytes = System.Text.Encoding.ASCII.GetBytes (LoginInfo);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = requestBytes.Length;
Stream requestStream = req.GetRequestStream();
requestStream.Write(requestBytes,0,requestBytes.Length);
requestStream.Close();
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
StreamReader sr = new StreamReader(res.GetResponseStream(), System.Text.Encoding.Default);
string backstr = sr.ReadToEnd(); Response.Write(line); sr.Close(); res.Close();<wbr></wbr>
string postData = "client_id="+ Sina.APP_ID +"&client_secret="+ Sina.APP_KEY +"&grant_type=authorization_code&redirect_uri="+ Sina.RedirectUrl +"&code="+code; byte[] bytes = Encoding.UTF8.GetBytes(postData); WebClient client = new WebClient(); client.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); client.Headers.Add("ContentLength", postData.Length.ToString()); byte[] responseData = client.UploadData("https://api.weibo.com/oauth2/access_token", "POST", bytes);