求大神把这段代码完成的功能用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个回答

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

应该是让你仿照上面这段写。。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问