my6731083 2015-07-23 09:43 采纳率: 0%
浏览 1542

求大神把这段代码完成的功能用asp代码写出来

protected void Button1_Click(object sender, System.EventArgs e)
{
XmlDocument doc = new XmlDocument();
String Account = TextBox1.Text.ToString();
String Password = TextBox2.Text.ToString();
String url = "http://3tong.net/http/sms/Submit";
String Phone = TextBox3.Text.ToString();
String sendtime = TextBox4.Text.ToString();
String sign = TextBox5.Text.ToString();
String subcode = TextBox6.Text.ToString();
String Content = TextBox8.Text.ToString();
String msgid = TextBox7.Text.ToString();
String message = DocXml(Account,Password,msgid,Phone,Content,subcode,sendtime,sign);

    WebClient webClient = new WebClient();
    NameValueCollection postValues = new NameValueCollection();
    postValues.Add("message", message);


    //向服务器发送POST数据
    byte[] responseArray = webClient.UploadValues(url, postValues);
    TextBox9.Text = Encoding.UTF8.GetString(responseArray);
}
  • 写回答

2条回答 默认 最新

  • my6731083 2015-07-23 10:16
    关注

    private static string DocXml(string account, string password, string msgid, string phones, string content,string subcode,string sendtime,string sign)
    {
    XmlDocument doc = new XmlDocument();
    XmlNode xmlnode = doc.CreateXmlDeclaration("1.0", "utf-8", null);
    doc.AppendChild(xmlnode);
    XmlElement xe1 = doc.CreateElement("response");
    XmlElement sub1 = doc.CreateElement("account");
    sub1.InnerText = account;
    xe1.AppendChild(sub1);
    XmlElement sub2 = doc.CreateElement("password");
    sub2.InnerText = md5(password);
    xe1.AppendChild(sub2);
    XmlElement sub3 = doc.CreateElement("msgid");
    sub3.InnerText = msgid;
    xe1.AppendChild(sub3);
    XmlElement sub4 = doc.CreateElement("phones");
    sub4.InnerText = phones;
    xe1.AppendChild(sub4);
    XmlElement sub5 = doc.CreateElement("content");
    sub5.InnerText = content;
    xe1.AppendChild(sub5);
    XmlElement sub6 = doc.CreateElement("subcode");
    sub6.InnerText = subcode;
    xe1.AppendChild(sub6);
    XmlElement sub7 = doc.CreateElement("sendtime");
    sub7.InnerText = sendtime;
    xe1.AppendChild(sub7);
    XmlElement sub8 = doc.CreateElement("sign");
    sub8.InnerText = sign;
    xe1.AppendChild(sub8);
    doc.AppendChild(xe1);
    return xe1.OuterXml;
    }

    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向