0

在我的 MVC 站点中,我使用下面的控制器操作从数据库返回图像。这在大多数情况下都可以正常工作。我遇到的唯一问题是在 IE8 及更低版本中,没有显示 png。他们改为显示红色的“X”。有任何想法吗?

public ActionResult Image(Guid id)
{
    ContentService svc = new ContentService();

    BinaryContent content = svc.GetBinaryContentById(id, "en-US");

    string mimeType = string.Format("image/{0}", content.BinaryType);
    string fileName = string.Format("{0}.{1}", id.ToString(), content.BinaryType);

    return File(content.Data, mimeType, fileName);
} 
4

0 回答 0