HttpRequest

stream发送请求

发送请求
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url4); req.Method = "POST"; byte[] bs = Encoding.GetEncoding("GB2312").GetBytes(json2); var stream = req.GetRequestStream(); stream.Write(bs, 0, bs.Length); stream.Dispose(); var response_temp = req.GetResponse(); using (HttpWebResponse response = (HttpWebResponse)response_temp) { var e = response.ContentEncoding; int responseCode = (int)response.StatusCode; using (var reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("GB2312"))) { responseData = reader.ReadToEnd(); //JObject j = new JObject(responseData); } }
接收请求
var
stream = Request.GetBufferedInputStream(); var sReader = new StreamReader(stream); var body = sReader.ReadToEnd();

如果由form表单提交,则

var action = Request["action"] ;

 

转载于:https://www.cnblogs.com/yy2056/p/3893914.html

你可能感兴趣的:(HttpRequest)