winform 调用 ashx
WebClient mywebclient = new WebClient(); byte[] cheklist = mywebclient.DownloadData(severurl + "/Provider/HandlerWinForm.ashx?deptid=" + Program.InstitutionID + "&method=insertadminlog"); string strcheck = Encoding.ASCII.GetString(cheklist);
WebClient wc=new WebClient (); StringBuilder sb=new StringBuilder (); string serverip = CommonBaseInfo.CommonUtil.Cryptography.DESSecurity.Decode(ConfigurationManager.AppSettings["serverip"]); sb.Append("ComplaintName=" + this.textBox1.Text); sb.Append("&ComplaintTel=" + this.textBox2.Text); sb.Append("&ComplaintPost=" + this.textBox4.Text); sb.Append("&ComplaintAdd=" + this.textBox3.Text); sb.Append("&ComplaintTitle=" + this.textBox5.Text); sb.Append("&ComplaintRemark=" + this.textBox6.Text); sb.Append("&method=insertcomplaint"); byte[] senddata=Encoding.UTF8.GetBytes(sb.ToString()); wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); wc.Headers.Add("ContentLength", senddata.Length.ToString()); byte[] returndata= wc.UploadData(serverip+ "/Provider/HandlerWinForm.ashx", "POST", senddata); string strcheck = Encoding.ASCII.GetString(returndata);