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

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

 return response;

 

posted @ 2016-09-05 22:13  GUOKUN  阅读(4891)  评论(1编辑  收藏  举报