asp.net web api返回图片至前端

2020-09-03 15:41:33 浏览数 (1)

代码语言:javascript复制
 var response = Request.CreateResponse(HttpStatusCode.OK);
 response.Content = new ByteArrayContent(data);  //data为二进制图片数据
 response.Content.Headers.ContentType = new MediaTypeHeaderValue("image/png");

 return response;

0 人点赞