Create a controller for displaying images with a Show action that takes the id of the image to display from the database. The action should return a FileResult that contains the image data with the appropriate content type.
public class ImageController : Controller
{
public ActionResult Show( int id )
{
var imageData = ...get bytes from database...
return File( imageData, "image/jpg" );
}
}
In your view, construct the image and use the image id to construct a path for the image using the controller and action.
<img src='<%= Url.Action( "show", "image", new { id = ViewData["imageID"] } ) %>' />
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…