问题描述
我想用ASP.NET做个小东西:向某些网站批量发送文本信息,请高手帮忙说说具体开发流程!!菜鸟先谢了!!!
解决方案
解决方案二:
privatevoidSetData(){stringurl="http://localhost:16248/WebForm1.aspx";stringdata="a=test&b=get";byte[]datas=System.Text.Encoding.UTF8.GetBytes(data);WebRequestrequest=WebRequest.Create(url);request.ContentType="application/x-www-form-urlencoded";request.ContentLength=datas.Length;request.Timeout=30*1000;request.Method="POST";StreamrequestStream=request.GetRequestStream();requestStream.Write(datas,0,datas.Length);requestStream.Close();HttpWebResponsehwr=(HttpWebResponse)request.GetResponse();StreamReadersr=newStreamReader(hwr.GetResponseStream());stringvalue=sr.ReadToEnd();sr.Close();hwr.Close();Response.Write(value);Response.Flush();}
时间: 2024-11-05 17:28:51