从asp.net中上传和显示图像
问题描述:
我将图像存储在数据库二进制格式中如何在我的网页上显示
I'm store the image in database Binary format how to show on My web page
答
您可以在文件响应中返回图像数据,以及mime类型为字符串:
You return the image data in a File response, along with the mime type as a string:
public ActionResult GetImage(blah, blah)
// Get the image data from the database
byte[] imageData = ...
// Set the mimetype appropriate for your image type.
string mimeType = "..."
// Return the file to the browser
return File(imageData, mineType);