大叔,代码是这样写的。
发起一个Http请求,返回的是一个Pdf数据流,我现在想要存储为一个Pdf文档,求指点啊~
byte[] bs = Encoding.UTF8.GetBytes(para);
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
req.Method = questMethod;
req.ContentType = "application/pdf";
req.ContentLength = bs.Length;
// 返回的流数据信息
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(bs, 0, bs.Length);
}
using (WebResponse wr = req.GetResponse())
{
StreamReader responseStream = new StreamReader(wr.GetResponseStream(), Encoding.UTF8);
strResponse = responseStream.ReadToEnd();
}