ASP.NET Web - Get Image from Database

This shows how to read image from Microsoft SQL server database. It streams a bitmap image and saves as jpeg image file. In order to improve the performance, I save the image in a directory where ASP.NET stores temporary files. If the request image exists in cache, it doesn't need to touch database and returns the existed image.

I create a generic handler called "GetProductImage.ashx". How to use it? For example in C#

imageObject.ImageUrl = "GetProductImage.ashx?id=" + image_id + "&width=130";
There are two input parameters: image ID and image width.




This DeleteCacheImage.ashx is to delete the cache jpeg images.



Facebook © 2017 Elaw Dream - Chiling Law. All rights reserved.

Visitors: voicexml