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);