POST传值问题
if (Regex.Match(Phone, @"(13[4-9]|15[8-9]){1}\d{8}").Success)
{
//Response.Write("<script>alert('移动!');window.history.back();</script>");
// return;
Encoding myEncoding = Encoding.GetEncoding("gb2312");
string param = HttpUtility.UrlEncode("userid", myEncoding) + "=" + HttpUtility.UrlEncode(Phone, myEncoding) + "&" + HttpUtility.UrlEncode("password", myEncoding) + "=" + HttpUtility.UrlEncode(Msg, myEncoding);
byte[] postBytes = Encoding.ASCII.GetBytes(param);
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("http://chineseserver.net:3388/CellServer/SmsAPI/UpdatePassword.jsp");
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded;charset=gb2312";
req.ContentLength = postBytes.Length;
using (Stream reqStream = req.GetRequestStream())
{
//reqStream.Write
reqStream.Write(postBytes, 0, postBytes.Length);
}
using (WebResponse wr = req.GetResponse())
{
//在这里对接收到的页面内容进行处理
}
}
值传不过去.这是为什么..哪出错了啊
{
//Response.Write("<script>alert('移动!');window.history.back();</script>");
// return;
Encoding myEncoding = Encoding.GetEncoding("gb2312");
string param = HttpUtility.UrlEncode("userid", myEncoding) + "=" + HttpUtility.UrlEncode(Phone, myEncoding) + "&" + HttpUtility.UrlEncode("password", myEncoding) + "=" + HttpUtility.UrlEncode(Msg, myEncoding);
byte[] postBytes = Encoding.ASCII.GetBytes(param);
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("http://chineseserver.net:3388/CellServer/SmsAPI/UpdatePassword.jsp");
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded;charset=gb2312";
req.ContentLength = postBytes.Length;
using (Stream reqStream = req.GetRequestStream())
{
//reqStream.Write
reqStream.Write(postBytes, 0, postBytes.Length);
}
using (WebResponse wr = req.GetResponse())
{
//在这里对接收到的页面内容进行处理
}
}
值传不过去.这是为什么..哪出错了啊
...全文
相关推荐
post方式直接传递值,页面传值注意事项
post方式直接传递值,页面传值注意事项
解决Django中checkbox复选框的传值问题
主要介绍了解决Django中checkbox复选框的传值问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
页面的传值
通过post来实现两个网站间的同步传输文本和图片
JSP页面间传值问题实例简析
主要介绍了JSP页面间传值问题,结合实例形式简单分析了JSP页面中使用get方式传值的使用技巧,需要的朋友可以参考下
两个jsp页面之间传值的问题,和checkbox多选框之间的问题
NULL 博文链接:https://houyajie.iteye.com/blog/2373485


