using System.Web; using System.Net; using System.Text; using System.IO;//创建对某个网站页面的请求HttpWebRequest myRequest = (HttpWebRequest )WebRequest.Create("http://www.website.com/a.asp")//上传的数据,”TextBox1“这些东东是网站页面里的控件ID,如果要上传多个值也是用&来分隔 string postData="TextBox1="+this.textBox1.Text+"&TextBox2="+this.textBox2.Text+"&TextBox3="+this.textBox3.Text+"&TextBox4="+this.textBox4.Text; ASCIIEncoding encoding=new ASCIIEncoding(); byte[] byte1=encoding.GetBytes(postData);//最终编码后要上传的数据 // Set the content type of the data being posted. myRequest.ContentType="application/x-www-form-urlencoded"; myRequest.Method="post";//post上传方式 // Set the content length of the string being posted. myRequest.ContentLength=postData.Length; Stream newStream=myRequest.GetRequestStream(); newStream.Write(byte1,0,byte1.Length); 一切就OK了,如果你想上传后看到网站的内容的话,可以在程序里放一个IE控件,使用axWebBrowser1.Navigate("http://www.website.com/a.asp"); axWebBrowser1.Refresh2();
这些人成天价就他女马的搞这些名堂,恶心!!!好好向Google学学,成得像人一点好不!~
“帖子提前太频繁了!!!”还没有操作过,怎么就太频繁了呀?
这些人成天价就他女马的搞这些名堂,恶心!!!好好向Google学学,做得像人一点好不!~
CSDV, 抄你妈!!!!!
using System.Net;
using System.Text;
using System.IO;//创建对某个网站页面的请求HttpWebRequest myRequest = (HttpWebRequest )WebRequest.Create("http://www.website.com/a.asp")//上传的数据,”TextBox1“这些东东是网站页面里的控件ID,如果要上传多个值也是用&来分隔 string postData="TextBox1="+this.textBox1.Text+"&TextBox2="+this.textBox2.Text+"&TextBox3="+this.textBox3.Text+"&TextBox4="+this.textBox4.Text;
ASCIIEncoding encoding=new ASCIIEncoding();
byte[] byte1=encoding.GetBytes(postData);//最终编码后要上传的数据
// Set the content type of the data being posted.
myRequest.ContentType="application/x-www-form-urlencoded";
myRequest.Method="post";//post上传方式
// Set the content length of the string being posted.
myRequest.ContentLength=postData.Length;
Stream newStream=myRequest.GetRequestStream();
newStream.Write(byte1,0,byte1.Length);
一切就OK了,如果你想上传后看到网站的内容的话,可以在程序里放一个IE控件,使用axWebBrowser1.Navigate("http://www.website.com/a.asp");
axWebBrowser1.Refresh2();