我可以使它与一起使用,而不是返回
StreamContentas 。
Content``ByteArrayContent
[HttpGet]public HttpResponseMessage Generate(){ var stream = new MemoryStream(); // processing the stream. var result = new HttpResponseMessage(HttpStatusCode.OK) { Content = new ByteArrayContent(stream.ToArray()) }; result.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment") { FileName = "CertificationCard.pdf" }; result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); return result;}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)