0
我有一个函数下面,用于返回图像和身份证。在测试时,我看不到我的ID被返回,而是我只能看到在浏览器中返回的图像(可能由于它完全是字节数据)。在铬HttpGet返回图像和身份证
int id = 0;
using (Bitmap bitmap = Image.Generate(context, out id))
{
HttpResponse response = context.Response;
response.CacheControl = "no-cache";
response.ContentType = "image/JPG";
bitmap.Save(response.OutputStream, ImageFormat.Jpeg);
response.End();
var responseModel = new ResponseModel
{
Id = id,
Image = bitmap
};
return Ok(responseModel);
};
这是返回响应的适当的方式,如果有包括图像?如果是这样,我如何从ajax调用获取响应数据,包括图像和ID(可以使用Json.parse完成吗?但这是bytedata)?