111,094
社区成员




myEncoding = Encoding.GetEncoding("utf-8");
string param = "";
if (!string.IsNullOrEmpty(cutWaterArea))
{
param += "," + "\"cutWaterArea\":\"" + HttpUtility.UrlEncode(cutWaterArea, myEncoding) + "\"";
}
if (!string.IsNullOrEmpty(temporaryId))
{
param += "," + "\"temporaryId\":\"" + temporaryId + "\"";
}
if (!string.IsNullOrEmpty(cutWaterTime))
{
param += "," + "\"cutWaterTime\":\"" + cutWaterTime + "\"";
}
if (!string.IsNullOrEmpty(cutWaterType))
{
param += "," + "\"cutWaterType\":\"" + HttpUtility.UrlEncode(cutWaterType, myEncoding) + "\"";
}
if (!string.IsNullOrEmpty(topRow))
{
param += "," + "\"topRow\":\"" + HttpUtility.UrlEncode(topRow, myEncoding) + "\"";
}
if (!string.IsNullOrEmpty(recoverTime))
{
param += "," + "\"recoverTime\":\"" + recoverTime + "\"";
}
if (!string.IsNullOrEmpty(detail))
{
param += "," + "\"detail\":\"" + HttpUtility.UrlEncode(detail, myEncoding) + "\"";
}
//myEncoding = Encoding.GetEncoding("ISO-8859-1");
//string param = "";
//if (!string.IsNullOrEmpty(cutWaterArea))
//{
// param += "," + "\"cutWaterArea\":" + cutWaterArea;
//}
//if (!string.IsNullOrEmpty(temporaryId))
//{
// param += "," + "\"temporaryId\":" + temporaryId;
//}
//if (!string.IsNullOrEmpty(cutWaterTime))
//{
// param += "," + "\"cutWaterTime\":" + cutWaterTime;
//}
//if (!string.IsNullOrEmpty(cutWaterType))
//{
// param += "," + "\"cutWaterType\":" + cutWaterType;
//}
//if (!string.IsNullOrEmpty(topRow))
//{
// param += "," + "\"topRow\":" + topRow;
//}
//if (!string.IsNullOrEmpty(recoverTime))
//{
// param += "," + "\"recoverTime\":" + recoverTime;
//}
//if (!string.IsNullOrEmpty(detail))
//{
// param += "," + "\"detail\":" + detail;
//}
param = "{" + param.TrimStart(',') + "}";
byte[] bs = Encoding.ASCII.GetBytes(param); //将参数转化为assic码
if (sffs == "0")
{
url = "http://xx/xx/xx.do";
}
else
{
url = "http://xx/xx/xx.do ";
}
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded;charset=utf-8";
req.ContentLength = bs.Length;
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(bs, 0, bs.Length);
}
using (WebResponse wr = req.GetResponse())
{
//在这里对接收到的页面内容进行处理
Stream responseStream = wr.GetResponseStream();
StreamReader streamReader = new StreamReader(responseStream, Encoding.UTF8);
string html = streamReader.ReadToEnd();
if (PublicMethod.NeedLog)
PublicMethod.WriteStringToFile(System.Threading.Thread.GetDomain().BaseDirectory + "\\WinServer_Yyxt_log.txt", html);
}