Hi,
Create a controller for displaying images with a Show action that takes the id of the file to display from the database. The action should return a FileResult that contains the file data with the appropriate content type.
here file is imageFile
public class FileController : Controller
{
public ActionResult Show( int id )
{
var imageFile = ...get bytes from database...
return File(imageFile, "image/jpg" );
}
}
In your view, construct the file and use the file id to construct a path for the file using the controller and action.
<img src='<%= Url.Action( "show", "file", new { id = ViewData["fileId"] } ) %>' />
I hope this will help you out.