0

错误

编译器错误消息:CS1502:重载“System.Web.WebPages.WebPageExecutingBase.Write (System.Web.WebPages.HelperResult)”的最合适方法有一些无效参数

 @ImageResultHelper.Image<ShowcaseController>(c => c.FileContentResult(), 200, 50, "Current time")

我需要将 new { bytes = item.ImageItems } 传输到 FileContentResult

4

1 回答 1

4

我们这样做的方式是返回一个FileContentResult

public FileResult Get()
{
    return new FileContentResult(image.Bytes, image.ContentType);
}

然后我们将图片的src设置为这个动作:

<img src="/Controller/Get/" alt="Whatever" />

这样您就可以缓存结果。

于 2012-03-22T17:29:36.367 回答