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

后端 未结 5 1854
情话喂你
情话喂你 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:16

    I'm not much of an expert on MVC yet - but from what I can see, I think your GetImage function needs to be an Action Method inside your controller, so it'll need to return an ActionResult?

    You'll probably need to set the Content-Type header in the response, too.

    This guy looks like he knows what he's talking about...

    http://blogs.msdn.com/miah/archive/2008/11/13/extending-mvc-returning-an-image-from-a-controller-action.aspx

提交回复
热议问题