HttpHelper下载pdf
获取pdf 获取不了。只能返回这样的数据:
%PDF-1.7
%³��
1 0 obj
<</Names <</Dests 4 0 R>> /Outlines 5 0 R /Pages 2 0 R /Type /Catalog>>
endobj
3 0 obj
<</Author (admin) /Comments () /Company () /CreationDate (D:20230116111054+03'10') /Creator (��
我用postman 是返回正常的,body都能显出先pdf的内容
无奈之下我只能使用原始方法:HttpWebRequest,HttpWebResponse 获取到了
也正常下载到了这个pdf文件
请问我是哪里写错了吗?
我是用fiddler获取到的代码
[C#] 纯文本查看 复制代码 private string GetHttp20230201150825()
{
SufeiUtil.HttpHelper http = new SufeiUtil.HttpHelper();
SufeiUtil.HttpItem item = new SufeiUtil.HttpItem()
{
URL = "http://192.168.3.97:12302/api/file/preview?fileLinkId=353127153438830592&storeId=message",
Method = "POST",
Accept = "application/json, text/plain, */*",
UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.70",
ContentType = "application/json",
Cookie = "VENUS-GW-SESSION=60fa47a8-529f-4c88-aa85-ab902f8d1ce4; VENUS-SSO-SESSION=337BE948CE9A4719C00000D3B451D0A2",
PostEncoding = Encoding.UTF8,
Postdata = "{\"query\":\"\"}"
};
SufeiUtil.HttpResult result = http.GetHtml(item);
string html = result.Html;
return html;
}
|