日期:2014-05-16 浏览次数:20469 次
client = new WebClient();
client.Encoding = Encoding.GetEncoding("utf-8");
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
client.Headers.Set("Content-Type", "application/x-www-form-urlencoded");
bytes = null;
address = "http://127.0.0.1/jie.aspx";
s = "name=xxx&b=xxx";
data = Encoding.UTF8.GetBytes(s);
bytes = client.UploadData(address, "POST", data);
if (Encoding.UTF8.GetString(bytes).StartsWith("SUCCESS"))
{
m.Issend = "发送成功";
}
else
{
m.Issend = "发送失败";
}
using (var reader = new System.IO.StreamReader(context.Request.InputStream))
{
String xmlData = reader.ReadToEnd();
}