3

我的视图中有一个图像,如:

    <img width="150" height="150" scr="@Url.Action("GetImage", "Item")" />

我的控制器 ItemController 有这个方法:

    public FileContentResult GetImage(){
        var model = _itemService.GetItemImage(1);
        if(model != null && model.ImageData != null){
            return File(model.ImageData, model.ImageMimeType);
        }
        return null;
    }

当视图呈现时,我的图像得到以下标记,但没有呈现图像:

    <img width="150" height="150" scr="/MyApp/ItemManagement/GetImage"/>

如果我在浏览器中输入这个 url 'http://localhost/MyApp/ItemManagement/GetImage',我会得到图像。我不确定这有什么问题。有人可以指出我的代码有什么问题吗?

提前致谢。杰夫

4

1 回答 1

7

图片属性应该是src...?

于 2011-08-29T19:16:36.230 回答