In this topic we will show how to view images, which are stored in database, in ASP.NET MVC 4 application. Images will not be cached on the server and will be sent directly to the client.

For doing our task we need:

Open Visual Studio .NET 2015.

Create an ASP.NET MVC 4 application project.

Add the references to the Vintasoft assemblies (version 8.6.4.1) and Vintasoft JavaScript files to the project:

Vintasoft.Shared.dll

Vintasoft.Shared.Web.dll

Vintasoft.Imaging.dll

Vintasoft.Imaging.Web.Services.dll

Vintasoft.Imaging.Web.ApiControllers.dll

Scripts\Vintasoft\Vintasoft.Shared.js

Scripts\Vintasoft\Vintasoft.Imaging.Html5.js

You can add the assemblies and JavaScript files manually or automatically. Add the "Vintasoft.Imaging.Web.ApiControllers" Nuget package to the project and the assemblies and JavaScript files will be added automatically.

Create a web service, which will get image from database and render image tile or thumbnail for web image viewer.

Create a Web API controller with name VintasoftDBImageApiController. Controller will be used for rendering of images and thumbnails.

Create the DataBaseImageStorage class, which will be used as a storage for images in database.

Create the DatabaseEmulator class, which will be used for emulating connection with database.

Specify that VintasoftDBImageApiController class must use DataBaseImageStorage class as a data storage for images.