当前位置:编程学习 > C#/ASP.NET >>

想向某些网站批量发送文本信息

  我想用ASP.NET做个小东西:向某些网站批量发送文本信息,请高手帮忙说说具体开发流程!!
菜鸟先谢了!!! --------------------编程问答-------------------- private void SetData()
{
string url = "http://localhost:16248/WebForm1.aspx";
string data = "a=test&b=get";

byte[] datas = System.Text.Encoding.UTF8.GetBytes(data);

WebRequest request = WebRequest.Create(url);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = datas.Length;
request.Timeout = 30 * 1000;
request.Method = "POST";

Stream requestStream = request.GetRequestStream();
requestStream.Write(datas, 0, datas.Length);
requestStream.Close();

HttpWebResponse hwr = (HttpWebResponse)request.GetResponse();
StreamReader sr = new StreamReader(hwr.GetResponseStream());
string value = sr.ReadToEnd();
sr.Close();
hwr.Close();

Response.Write(value);
Response.Flush();
}
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,