Problem with displaying image from DB using asp.net MVC 2

后端 未结 5 1847
情话喂你
情话喂你 2021-01-17 00:41

I\'m having trouble with displaying image from db. I think that method for saving image is working, because I see in DB that varbinary fields have some value, and that image

5条回答
  •  旧时难觅i
    2021-01-17 01:00

    Try to change you method to:

    public void GetImage(int productID)
    {
        Product product = products.GetByID(productID);
    
        Response.ContentType = "image/jpeg";
        Response.BinaryWrite(product.ImageData.ToArray());
    
    }
    

提交回复
热议问题