Outputting a byte arrain into the src attribute of an img tag

前端 未结 2 772
感动是毒
感动是毒 2020-12-11 16:07

I\'m using ASP.NET MVC and have a model which has an image (byte array) in one of the fields. I\'m trying to output this image into the src attribute of the img tag. I\'m lo

2条回答
  •  粉色の甜心
    2020-12-11 16:51

    The browser uses the src attribute to issue a separate request to the server, to get the contents of the image. It does not display the bytes in the src as the image itself.

    So you will need to remember those bytes (session?) and use a handler (the url you put into the src attribute) to let the browser request them.

提交回复
热议问题